Tested a QML TableModel to view the model data.

This commit is contained in:
2026-03-04 19:56:12 +01:00
parent 2ff97c588c
commit 7b6979288a

View File

@ -1,4 +1,6 @@
import QtQuick import QtQuick
import QtQuick.Layouts
import QtQml.Models
Window { Window {
width: 640 width: 640
@ -6,8 +8,32 @@ Window {
visible: true visible: true
title: qsTr("Hello World") title: qsTr("Hello World")
Text { ColumnLayout {
text: "Model row count: " + mainModel.rowCount() anchors.fill: parent
anchors.centerIn: parent
Text {
text: "Model row count: " + mainModel.rowCount()
Layout.alignment: Layout.Center
}
TableView {
Layout.fillWidth: true
Layout.fillHeight: true
Layout.margins: 10
columnSpacing: 1
rowSpacing: 1
clip: true
model: mainModel
delegate: Rectangle {
implicitWidth: 100
implicitHeight: 50
Text {
text: display
}
}
}
} }
} }