Using a ListView with a simple delegate component.
This commit is contained in:
38
Main.qml
38
Main.qml
@ -3,37 +3,17 @@ import QtQuick.Layouts
|
||||
import QtQml.Models
|
||||
|
||||
Window {
|
||||
width: 640
|
||||
height: 480
|
||||
id: window
|
||||
width: 480
|
||||
height: 800
|
||||
visible: true
|
||||
title: qsTr("Hello World")
|
||||
title: `${Application.name}`
|
||||
|
||||
ColumnLayout {
|
||||
property color textColor: "black"
|
||||
property int fontSize: 16
|
||||
|
||||
ListPage {
|
||||
id: listPage
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user