native: make table nice

This commit is contained in:
Johannes Jöns 2024-07-11 21:54:27 +02:00
parent 1b33431bc0
commit e2ca009d35
2 changed files with 47 additions and 43 deletions

View file

@ -96,7 +96,7 @@ Window {
name: nameT.text, name: nameT.text,
key: keyT.text, key: keyT.text,
amount: parseInt(amountT.text), amount: parseInt(amountT.text),
group_id: "f7604976-1e3c-49b7-841b-6a4025257c70", group_id: "ff664d29-68c9-45c2-a6bc-8f378876c90d",
}); });
xhr.send(data); xhr.send(data);

View file

@ -4,6 +4,8 @@ import QtQuick.Layouts 2.15
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
Rectangle { Rectangle {
visible: true
SystemPalette { id: activeColors; colorGroup: SystemPalette.Active } SystemPalette { id: activeColors; colorGroup: SystemPalette.Active }
SystemPalette { id: inactiveColors; colorGroup: SystemPalette.Inactive } SystemPalette { id: inactiveColors; colorGroup: SystemPalette.Inactive }
SystemPalette { id: disabledColors; colorGroup: SystemPalette.Disabled } SystemPalette { id: disabledColors; colorGroup: SystemPalette.Disabled }
@ -26,37 +28,20 @@ Rectangle {
height: 50 height: 50
color: getColors().midlight color: getColors().midlight
RowLayout {
anchors.fill: parent
spacing: 10
anchors.margins: 5
TextField { TextField {
anchors {
verticalCenter: s1.verticalCenter
rightMargin: 5
right: loginB.left
}
placeholderText: qsTr("Search") placeholderText: qsTr("Search")
} Layout.alignment: Qt.AlignVCenter
Layout.fillWidth: true
Button {
id: loginB
anchors {
verticalCenter: s1.verticalCenter
rightMargin: 10
right: s1.right
}
text: qsTr("Logout")
onClicked: {
logout();
}
} }
Button { Button {
text: qsTr("Add License") text: qsTr("Add License")
anchors { Layout.alignment: Qt.AlignVCenter
verticalCenter: s1.verticalCenter
rightMargin: 10
right: loginB.left
}
onClicked: { onClicked: {
// Create and show a new window // Create and show a new window
var newWindow = newWindowComponent.createObject(null, { authToken: authToken }); var newWindow = newWindowComponent.createObject(null, { authToken: authToken });
@ -67,6 +52,16 @@ Rectangle {
} }
} }
} }
Button {
id: loginB
text: qsTr("Logout")
Layout.alignment: Qt.AlignVCenter
onClicked: {
logout();
}
}
}
} }
Rectangle { Rectangle {
@ -84,46 +79,55 @@ Rectangle {
} }
ListView { ListView {
anchors { id: listView
topMargin: 5 anchors.fill: parent
fill: s2
}
clip: true clip: true
boundsBehavior: Flickable.StopAtBounds boundsBehavior: Flickable.StopAtBounds
model: apiDataModel model: apiDataModel
delegate: Item { delegate: Rectangle {
width: parent.width width: listView.width
height: 50 height: 50
color: getColors().button
Row { RowLayout {
anchors.fill: parent
spacing: 10 spacing: 10
Text { Text {
text: model.name text: model.name
color: getColors().text color: getColors().text
Layout.alignment: Qt.AlignVCenter
} }
Text { Text {
text: model.key text: model.key
color: getColors().text color: getColors().text
Layout.alignment: Qt.AlignVCenter
} }
Text { Text {
text: model.amount text: model.amount
color: getColors().text color: getColors().text
Layout.alignment: Qt.AlignVCenter
} }
Text { Text {
text: model.start text: model.start
color: getColors().text color: getColors().text
Layout.alignment: Qt.AlignVCenter
} }
Text { Text {
text: model.end text: model.end
color: getColors().text color: getColors().text
Layout.alignment: Qt.AlignVCenter
} }
Text { Text {
text: model.group text: model.group
color: getColors().text color: getColors().text
Layout.alignment: Qt.AlignVCenter
} }
} }
} }