Details
-
Task
-
Resolution: Fixed
-
P2: Important
-
None
-
QDS 4.4.1
-
None
-
3
-
cae86d697 (qds/dev)
-
QDS Oulu - 2024 Week 7/8
Description
If a model is assigned to a ListView element, it should work as following
- The user has a ListView component already in the screen, or it is dragged out of library. He/she sees the content in the Model Editor
- Another Model is assigned to the ListView
- ListView gets the content from the model
QML Example of the delegate which would be the end result
import QtQuick 6.5import QtQuick.Controls 6.5import ModelEditor_2import QtQuick3D 6.5 Rectangle { id: rectangle width: Constants.width height: Constants.height ListView { id: listView x: 176 y: 284 width: 658 height: 119 spacing: 1 keyNavigationWraps: false orientation: ListView.Vertical model: ListModel { ListElement { isbn: "" title: "Sayings of the Century" price: 8.95 category: "reference" author: "Nigel Rees" } ListElement { isbn: "" title: "Sword of Honor" price: 12.99 category: "fiction" author: "Evelyn Waugh" } ListElement { isbn: "0-553-21311-3" title: "Moby Dick" price: 8.99 category: "fiction" author: "Herman Melville" } ListElement { isbn: "0-395-19395-8" title: "The Lord of the Rings" price: 22.99 category: "fiction" author: "J.R.R. Tolkien" } } delegate: Item { x: 5 width: 150 height: 20 anchors.leftMargin: 0 Row { id: row1 spacing: 30 Column { id: col1 spacing: 20 width: 100 Text { text: author anchors.left: parent.left anchors.leftMargin: 0 horizontalAlignment: Text.AlignLeft font.bold: true } } Column { id: col2 spacing: 20 width: 70 Text { text: category anchors.left: parent.left anchors.leftMargin: 0 horizontalAlignment: Text.AlignLeft font.bold: true } } Column { id: col3 spacing: 20 width: 50 Text { text: price anchors.left: parent.left anchors.leftMargin: 0 horizontalAlignment: Text.AlignLeft font.bold: true } } Column { id: col4 spacing: 20 width: 200 Text { text: title anchors.left: parent.left anchors.leftMargin: 0 font.bold: true } } Column { id: col5 spacing: 20 width: 100 Text { text: isbn anchors.left: parent.left anchors.leftMargin: 0 horizontalAlignment: Text.AlignLeft font.bold: true } } } } }}
Attachments
For Gerrit Dashboard: QDS-11776 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
539817,6 | QmlDesigner: Create proper ListView delegate for assigned model | qds/dev | qt-creator/qt-creator | Status: MERGED | +2 | 0 |