Error in ItemDelegate
-
Hi every one i am doing the QML tutorial "chat application" and i got and error on this code :
ListView { id: listView anchors.fill: parent topMargin: 48 leftMargin: 48 bottomMargin: 48 rightMargin: 48 spacing: 20 model: ["Albert Einstein", "Ernest Hemingway", "Hans Gude"] ItemDelegate{ text: modelData width: listView.width - listView.leftMargin - listView.rightMargin height: avatar.implicitHeight leftPadding: avatar.implicitWidth + 32 Image { id: avatar source: "qrc:/:/../../../Téléchargements/material-design-icons-master/action/1x_web/ic_account_circle_white_48dp.png" }
The error is
qrc:/main.qml:40: ReferenceError: modelData is not defined
I don't know how to correct it. Thanks in advance
-
Hi every one i am doing the QML tutorial "chat application" and i got and error on this code :
ListView { id: listView anchors.fill: parent topMargin: 48 leftMargin: 48 bottomMargin: 48 rightMargin: 48 spacing: 20 model: ["Albert Einstein", "Ernest Hemingway", "Hans Gude"] ItemDelegate{ text: modelData width: listView.width - listView.leftMargin - listView.rightMargin height: avatar.implicitHeight leftPadding: avatar.implicitWidth + 32 Image { id: avatar source: "qrc:/:/../../../Téléchargements/material-design-icons-master/action/1x_web/ic_account_circle_white_48dp.png" }
The error is
qrc:/main.qml:40: ReferenceError: modelData is not defined
I don't know how to correct it. Thanks in advance
@adonisQt97 I opened the Qt Quick Control 2 - Chat Tutorial, built subproject chapter2-lists and it runs well. We need more info about your setup. Creator version, Qt version, OS etc. And how you compile and run it.
-
The item delegate should be assigned to ListView::delegate:
ListView { ... delegate: ItemDelegate { ... } }
-
@adonisQt97 I opened the Qt Quick Control 2 - Chat Tutorial, built subproject chapter2-lists and it runs well. We need more info about your setup. Creator version, Qt version, OS etc. And how you compile and run it.
@Eeli-K | I am redoing it by following the tutorial !!
-
The item delegate should be assigned to ListView::delegate:
ListView { ... delegate: ItemDelegate { ... } }
@jpnurmi thank you it work well