Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Posts: 324
Registered: ‎03-10-2010
My Device: Bold 9780, DevAlpha
My Carrier: Vodafone CZ
Accepted Solution

Application menu unavailable twice after Sheet closed

void MyApp::feedbackTriggered() {
	Sheet *s = Application::instance()->scene()->findChild<Sheet*>(
			"menuUserSheet");
	if (s) {
		qDebug() << "feedback triggered and Feedback Sheet found";
		s->open();
	} else {
		qDebug() << "feedback triggered, but no Feedback Sheet found";
	}
}

It works only once. When i'm trying to open at second time - ApplicationMenu crashed and no available anymore to use. What is a problem? 

Developer
Posts: 1,688
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
My Carrier: Telekom.de, O2, Vodafone

Re: Application menu unavailable twice after Sheet closed

this is a know bug from Beta4 and Gold

 

but I got info that its fixed in the meantime and will work with next OS Update

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner http://vimeo.com/ekkescorner/videos
bb10-development: http://appbus.org Twitter: @ekkescorner
Developer
Posts: 324
Registered: ‎03-10-2010
My Device: Bold 9780, DevAlpha
My Carrier: Vodafone CZ

Re: Application menu unavailable twice after Sheet closed

Thanks! I've lost about hour to find 'where i'm wrong' Smiley Sad

Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: Application menu unavailable twice after Sheet closed

Hi! Recreate the Sheet before showing it as a workaround.

 


Andrey Fidrya, @zmeyc on twitter
Developer
Posts: 324
Registered: ‎03-10-2010
My Device: Bold 9780, DevAlpha
My Carrier: Vodafone CZ

Re: Application menu unavailable twice after Sheet closed

Can you post the sample code?

Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: Application menu unavailable twice after Sheet closed

[ Edited ]

I do this in C++:

	Sheet *sheet = Sheet::create()
			.content(new SettingsPage);
	QObject::connect(sheet, SIGNAL(closed()), sheet, SLOT(deleteLater()));
	sheet->open();

 


Andrey Fidrya, @zmeyc on twitter
Developer
Posts: 324
Registered: ‎03-10-2010
My Device: Bold 9780, DevAlpha
My Carrier: Vodafone CZ

Re: Application menu unavailable twice after Sheet closed

Great... but how to do this in QML?

Highlighted
Developer
Posts: 324
Registered: ‎03-10-2010
My Device: Bold 9780, DevAlpha
My Carrier: Vodafone CZ

Re: Application menu unavailable twice after Sheet closed

var sheet = sheetObj.createObject();
sheetObj.getContent().signalfunc.connect(...)

 ?

Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: Application menu unavailable twice after Sheet closed

I think it's not possible with QML only. Call the C++ function from QML:

 

1) Set QML context to point to your class:

QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
...
qml->setContextProperty("myClass",this);

2) Declare the function in header file as Q_INVOKABLE:

 

 Q_INVOKABLE void showSettings();

 3) Call it from QML:

myClass.showSettings();

 

 

 

 

 

 


Andrey Fidrya, @zmeyc on twitter
Developer
Posts: 291
Registered: ‎10-15-2012
My Device: bb10 developer
My Carrier: Orange

Re: Application menu unavailable twice after Sheet closed

It is possible with QML

 

Put the Sheet as ComponentDefinition and then use createObject in QML to create the sheet