Quantcast
Channel: QtWebEngine
Viewing all articles
Browse latest Browse all 13965

Accessing nested ListModel in a separate file issue...

$
0
0
Hello, I am new to Qt, so please bear with me if I am posting a silly question. I have a nested ListModel in a separate file as follows (I just put one element in there for brevity): import QtQuick 1.0   ListModel {    id: topModel    ListElement {       mainScreen: [          ListElement {             title: "Settings"          }       ]    } } I have a separate qml file that has the ListView to access the nested “mainScreen” list as follows: ListView {    id: list2    y: 10; width: 100; height: 100    focus: true    model: topModel.get(0).mainScreen    delegate: MainScreenDelegate {} } When I run it, it gives me the following error and does not show anything : ReferenceError: Can’t find variable: topModel Please help me identify what I do it wrong. Thanks.

Viewing all articles
Browse latest Browse all 13965

Trending Articles