native: add LoginScreen

This commit is contained in:
Schnitzel 2024-07-10 19:50:31 +02:00
parent bcf6b64a7a
commit b7243d67e5

View file

@ -1,63 +1,80 @@
import QtQuick
import QtQuick.Window
import Qt.labs.qmlmodels
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Controls.Basic
//import "Main.qml" as M
Window {
SystemPalette { id: activeColors; colorGroup: SystemPalette.Active }
SystemPalette { id: inactiveColors; colorGroup: SystemPalette.Inactive }
SystemPalette { id: disabledColors; colorGroup: SystemPalette.Disabled }
function getColors() {
return root.active ? activeColors : inactiveColors;
}
width: 400
height: 400
visible: true
TableView {
anchors.fill: parent
columnSpacing: 1
rowSpacing: 1
boundsBehavior: Flickable.StopAtBounds
color: getColors().window
model: TableModel {
TableModelColumn { display: "checked" }
TableModelColumn { display: "amount" }
TableModelColumn { display: "fruitType" }
TableModelColumn { display: "fruitName" }
TableModelColumn { display: "fruitPrice" }
// 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
}
]
Label{
id: loginL
anchors{
verticalCenter: parent.verticalCenter
verticalCenterOffset: -70
horizontalCenter: parent.horizontalCenter
}
delegate: TextInput {
text: model.display
padding: 12
selectByMouse: true
onAccepted: model.display = text
Rectangle {
anchors.fill: parent
color: "#efefef"
z: -1
}
text: qsTr("Login")
font.pointSize: 20
font.bold: true
color: getColor().text
}
TextField {
id: nameT
anchors{
horizontalCenter: parent.horizontalCenter
topMargin: 5
top: loginL.bottom
}
placeholderText: qsTr("Name")
}
TextField {
id: passwordT
anchors{
horizontalCenter: parent.horizontalCenter
topMargin: 5
top: nameT.bottom
}
placeholderText: qsTr("Password")
echoMode: TextInput.Password
}
Button {
id: submitB
anchors{
right: passwordT.right
topMargin: 5
top: passwordT.bottom
}
text: qsTr("Submit")
}
}