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
d3v3l0p3r
Posts: 168
Registered: ‎07-19-2012
My Device: Q5, Q10, Z10, Z30, PlayBook
Accepted Solution

Multiple QML roots

What is the best approach for scenario where upon application launch I need to do some pre-processing and display UI which is completely not related with the UI of the application. 

 

Specifically I need to do some database integrity checks (upon app startup) and display user with message / dialogs in event there are db issues. 

 

I would like in my C++ do this logic and if neccessary create QMLDocument root with a specific QML file, and upon action in that QML file return back to C++ and create another QMLDocument with a main application root and QML files.

 

THis way I would not complicate my main QML tree with unneccessary QML objects which are used only at start up and have a clean separation between main app and the startup process.

---
If you find my post helpful please "like" it and "accept as a solution"
Developer
Zmey
Posts: 1,515
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: Multiple QML roots

One approach is to show a Sheet on application start then dismiss and destroy the sheet when it's no longer needed.

 

You can describe the entire sheet in qml or create a sheet in .cpp, then load a page from qml using QmlDocument then add the page to the sheet and so on. Basically any objects can be instantiated from qml and then destroyed when no longer needed.

 

It should be also possible to replace Application's scene with another controls hierarchy by calling Application::instance()->setScene() but there will be no transition animation in this case I think. It's possible to animate the transition manually but it'll require more work.

 

I hope I understand the question correctly. :smileyhappy:

 


Andrey Fidrya, @zmeyc on twitter
Developer
d3v3l0p3r
Posts: 168
Registered: ‎07-19-2012
My Device: Q5, Q10, Z10, Z30, PlayBook

Re: Multiple QML roots

Thank you! Application::instance()->setScene() is what I was looking for. I was using app->setScene() and that was crashing.

---
If you find my post helpful please "like" it and "accept as a solution"