I am unable to make my class derived from QAbstractListModel working with qml ListView.
Situation looks like this:
I have created ButtonMenu QML element:
Rectangle {
id: menuRoot
...
property Component model
...
Rectangle {
id: menuRoot
...
property Component model
...
To copy to clipboard, switch view to plain text mode
In this element I have another one and in this another one I have ListView element
Rectangle {
id: menu
...
ListView {
id: menuList
...
model: menuRoot.model;
...
Rectangle {
id: menu
...
ListView {
id: menuList
...
model: menuRoot.model;
...
To copy to clipboard, switch view to plain text mode
Now when I create ButtonMenu element I have something like this:
ButtonMenu {
id: buttonMenu
...
model: menuMainViewArea
...
ButtonMenu {
id: buttonMenu
...
model: menuMainViewArea
...
To copy to clipboard, switch view to plain text mode
In C++ I do this:
ctxt->setContextProperty("menuMainViewArea",engine.getMenuMainViewArea());
ctxt->setContextProperty("menuMainViewArea",engine.getMenuMainViewArea());
To copy to clipboard, switch view to plain text mode
When I run my program i get following error:
Error: Cannot assign QObject* to QDeclarativeComponent*
I tried to make model in menuRoot an alias to menuList model but when I called model.count when setting size of all rectangles I got model.count undefined.
Does anyone know what can be wrong??
Bookmarks