03-05-2013 05:55 AM - edited 03-05-2013 05:58 AM
I want to ask an opinion of community here.
I am developing a BB-10 app which has more or less forllowing UI structure.
In my app I will need probably one navigation object (e.g., NavigationPane).
Users must then be able to open different windows/dialogs inside this NavigationPane
(e.g., stack like structure).
What I am thinking to do is have one instance of NavigationPane class throughout
whole application, e.g., NavigationPane* mRoot;
For each page that a user may open inside this NavigationPane, I want to
have a separate class which will probably inherit from Page. e.g.,
userDetailsPage (inherits from Page)
settingsPage(inherits from Page), etc.
Now, when the user clicks some button on the app. I want corresponding
page to be displayed in the NavigationPane.
This I will do by invoking a function for example from my main class which will
call smth like: mRoot->push(mNewPage);
My question is following: do you think it is ok to have an architecture like this?
One challenge that remains with me and I don't know yet how/or whether it is possible to do it is following.
I want each my custom page, to have a corresponding .qml file
which will show when my page is added to the NavigationPane.
How and where should I add this functionality? (In the constructor of my custom Page??).
This way I want also to be able to set up an interaction between my custom Page
class object and the .qml file (e.g., maybe store data objects in the class object and
access from QML).
Do you think if such an architecture is doable within Cascades? Thanks.
03-05-2013 06:06 AM - edited 03-05-2013 06:09 AM
More than doable, recommended I would say.
The architecture you have specified is more or less the one used in the cookbook I suggest you download that and see just how simple it is to do what you describe.
The secret sauce is the use of ComponentDefinition.
Good luck with your app.
03-05-2013 09:21 AM - edited 03-05-2013 09:22 AM
Hi, this looks very similar thanks.
Let me ask you one more question and it would be nice if you could give some tipps.
This looks very similar just in this sample everything is done in C++.
In my case I am thinking to use bit of QML. So, let's takle for example
the ButtonRecipe c++ class from the cookbook sample which is used just
to show some button functionalities and which inherits CustomControl.
This class does all in cpp, UI, implementation etc.
In my case, I would like to have three files basically:
buttonRecipe.cpp (which could implement the logic, have some functions
accessible via QML etc.), buttonRecipe.h, and buttonRecipe.qml -- which would
do the UI. So, how do I tie the buttonRecipe.qml to the buttonRecipe.cpp such
that when the .cpp file loads, the qml file is shown? Thank you.
ps. I know how to expose the buttonRecipe.cpp to the buttonRecipe.qml then later on
so that I could use cpp functionality from QML if needed.
Thank you in advance once again.
03-05-2013 10:34 AM - edited 03-05-2013 10:46 AM
Actually if you look again you'll see there are two versions of the cookbook one that uses C++ and the other in QML.
So there is really no point me re-inventing the wheel when a QML example exists already for you to adapt.
If you have a question about QML/C++ integration then please close off this thread by accepting this post as the solution and then searching for the many other threads that have already asked this question or read this...
03-05-2013 11:28 AM - edited 03-05-2013 11:34 AM
Hi, thanks- I am not reinventing the wheel, I mentioned ButtonRecipe class as an exmaple, of course in my case
there will be a different class. I think I basically must figure out how to embed a QML file into a CustomComponent (or a c++ class that inherits from Page). And maybe some other things. Anyway, thanks, I will go through it tomorrow once again, ask some more questions if I have -- and otherwise accept the solution if all is ok.
ps. forgot to mention - thakns for the links anyway, I think they maybe helpful, just those are like two extremes: one is completely c++ based, another completely QML based.
03-05-2013 12:19 PM - edited 03-05-2013 12:23 PM
I think when you do you'll see that it answers your original post, giving an example of how to do dynamic pages and how QML and C++ can interact together. The selectioncheckbox being just one example.
Best of luck.