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
AlexXF
Posts: 323
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? 

Please use plain text.
Developer
ekke
Posts: 1,503
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
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

Open Source Enthusiast
blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner
bb10-development: http://appbus.org Twitter: @ekkescorner
Please use plain text.
Developer
AlexXF
Posts: 323
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' :smileysad:

Please use plain text.
Developer
Zmey
Posts: 1,512
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: Application menu unavailable twice after Sheet closed

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

 


Andrey Fidrya, @zmeyc on twitter
Please use plain text.
Developer
AlexXF
Posts: 323
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?

Please use plain text.
Developer
Zmey
Posts: 1,512
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

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
Please use plain text.
Developer
AlexXF
Posts: 323
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?

Please use plain text.
Developer
AlexXF
Posts: 323
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(...)

 ?

Please use plain text.
Developer
Zmey
Posts: 1,512
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

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
Please use plain text.
Developer
strobejb
Posts: 276
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

Please use plain text.