From 7b6979288abf8620edbf277f154d505837aa1715 Mon Sep 17 00:00:00 2001 From: Bent Witthold Date: Wed, 4 Mar 2026 19:56:12 +0100 Subject: [PATCH] Tested a QML TableModel to view the model data. --- Main.qml | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/Main.qml b/Main.qml index 1cb8933..592180a 100644 --- a/Main.qml +++ b/Main.qml @@ -1,4 +1,6 @@ import QtQuick +import QtQuick.Layouts +import QtQml.Models Window { width: 640 @@ -6,8 +8,32 @@ Window { visible: true title: qsTr("Hello World") - Text { - text: "Model row count: " + mainModel.rowCount() - anchors.centerIn: parent + ColumnLayout { + anchors.fill: 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 + } + } + } } }