Alisa/native/Test.qml

64 lines
1.7 KiB
QML
Raw Normal View History

2024-07-10 22:24:28 +02:00
import QtQuick 2.12
2024-07-11 13:02:41 +02:00
import QtQuick.Window 2.12
import Qt.labs.qmlmodels 1.0
2024-07-10 15:00:00 +02:00
2024-07-11 13:02:41 +02:00
Window {
width: 400
height: 400
2024-07-10 15:00:00 +02:00
visible: true
2024-07-11 13:02:41 +02:00
TableView {
anchors.fill: parent
columnSpacing: 0
rowSpacing: 1
boundsBehavior: Flickable.StopAtBounds
2024-07-10 15:00:00 +02:00
2024-07-11 13:02:41 +02:00
model: TableModel {
TableModelColumn { display: "checked" }
TableModelColumn { display: "amount" }
TableModelColumn { display: "fruitType" }
TableModelColumn { display: "fruitName" }
TableModelColumn { display: "fruitPrice" }
2024-07-10 15:00:00 +02:00
2024-07-11 13:02:41 +02:00
// 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
}
}
2024-07-10 15:00:00 +02:00
}
}