View Single Post
Posts: 642 | Thanked: 486 times | Joined on Aug 2008
#3
Originally Posted by abuelmagd View Post
I would also rather if the models used by QML views were all created and manipulated in Qt. I fetch the data and manipulate it on the Qt side and then pass them to QML as arguments of signals. I wish things were simpler and that QML was extracted away from all logic as you're suggesting.
Yes that would be better. I have got close to that though, consider this approach. My app is mainly about showing you stuff on ebay - so it's generally backed up by some custom data models - so each delegate can access the different roles quite easily, simply by using the name.

HOWEVER I ALSO have a different method - you pass the roleName and index and you get back the data, so from ANY QML element I have access to every single element in ALL models!

What I have learned from all this is the following:

EACH page/view should be managed within QML - swtiching from one view to another, e.g. pageStack.push(xxx) should be done from Qt. However you then need good seperation between, the model and the GUI controller in Qt.
__________________
Checkout my new eBay app for the N9