native: Test tabel

This commit is contained in:
Schnitzel 2024-07-11 13:02:41 +02:00
parent 83c2a7c954
commit 2550a6d79f
3 changed files with 69 additions and 25 deletions

View file

@ -99,4 +99,18 @@ Rectangle {
});
xhr.send(data);
}
Button {
id: loginScreenB
anchors {
bottom: parent.bottom
left: parent.left
}
text: qsTr("Test")
onClicked: {
var component = Qt.createComponent("Test.qml")
var window = component.createObject(root)
window.show()
}
}
}

View file

@ -60,7 +60,6 @@ Rectangle {
right: parent.right
bottom: parent.bottom
}
radius: 0
color: getColors().window
TableView {
@ -95,18 +94,4 @@ Rectangle {
}
}
}
Button {
id: loginScreenB
anchors {
bottom: parent.bottom
left: parent.left
}
text: qsTr("Login Screen")
onClicked: {
logout();
}
}
}

View file

@ -1,18 +1,63 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Controls.Universal 2.12
import QtQuick.Window 2.12
import Qt.labs.qmlmodels 1.0
ApplicationWindow {
Window {
width: 400
height: 400
visible: true
Universal.theme: Universal.Dark
Universal.accent: Universal.Violet
TableView {
anchors.fill: parent
columnSpacing: 0
rowSpacing: 1
boundsBehavior: Flickable.StopAtBounds
Column {
anchors.centerIn: parent
model: TableModel {
TableModelColumn { display: "checked" }
TableModelColumn { display: "amount" }
TableModelColumn { display: "fruitType" }
TableModelColumn { display: "fruitName" }
TableModelColumn { display: "fruitPrice" }
RadioButton { text: qsTr("Small") }
RadioButton { text: qsTr("Medium"); checked: true }
RadioButton { text: qsTr("Large") }
// Each row is one type of fruit that can be ordered
rows: [
{
// Each property is one cell/column.
checked: false,
amount: 1,
fruitType: "Apple",
fruitName: "Granny Smith",
fruitPrice: 1.50
},
{
checked: true,
amount: 4,
fruitType: "Orange",
fruitName: "Navel",
fruitPrice: 2.50
},
{
checked: false,
amount: 1,
fruitType: "Banana",
fruitName: "Cavendish",
fruitPrice: 3.50
}
]
}
delegate: TextInput {
text: model.display
padding: 12
selectByMouse: true
onAccepted: model.display = text
Rectangle {
anchors.fill: parent
color: "#efefef"
z: -1
}
}
}
}