Need a tip which model to use
-
I'm studing QML and its models. I want to create app for browsing libraries for OCaml language. This is what I have now
!http://wstaw.org/m/2012/11/30/plasma-desktopxJ4771.png(now)!
You see two listviews with items. Let's suppose we have N listviews. After selecting some item in listView M there are two possible behaviors:
ListViews from M+1 to N are removed. If item has subitems new ListView showing contents of selected item in ListView number M is added to the right.
ListViews from M+1 to N are removed. If item has no subitems no listViews are created. The field for item's description is changed.
I have a sort of realization "now":https://github.com/Kakadu/QOcamlBrowser/tree/4a662fd03d38c99731af893edff1a858fe433f58 . "This is QML file":https://github.com/Kakadu/QOcamlBrowser/blob/4a662fd03d38c99731af893edff1a858fe433f58/qml/QOcamlBrowser/main.qml
My model is number -- count of ListViews. I have C++ object using which I can get items for each ListView. But I have problems with updating: when model changed all listviews are reevaluted and it is not good because I need to set back selected indexes for each ListView. I want some kind of model and view which will not reevaluate all content after selecting something.
Do you have any ideas how to implemet it? Can I use Lists of QObjects? Or it is better to inherit QAbstractItemModel?
P.S. "This is Qt manpage about models for fast access":http://doc.qt.digia.com/qt/qdeclarativemodels.html