Models and roles in Qt5 and Qt 4.8
问题 Today I wanted to play with QtQuick2 a little bit. So I have started to port very simple Qt Quick1 app to Quick2. This app uses some models. And in Qt5 models are not working as I expect: I can't access data using roles. This is my QML code: import QtQuick 2.0 Rectangle { width: 800 height: 360 ListView { model: mainModel spacing: 5 anchors.fill: parent orientation: ListView.Vertical delegate: Text { text: "1" Component.onCompleted: { console.log(mainModel); console.log(mainModel.roles() );