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,44 +28,37 @@ Rectangle {
height: 50 height: 50
color: getColors().midlight color: getColors().midlight
TextField { RowLayout {
anchors { anchors.fill: parent
verticalCenter: s1.verticalCenter spacing: 10
rightMargin: 5 anchors.margins: 5
right: loginB.left
TextField {
placeholderText: qsTr("Search")
Layout.alignment: Qt.AlignVCenter
Layout.fillWidth: true
} }
placeholderText: qsTr("Search") Button {
} text: qsTr("Add License")
Layout.alignment: Qt.AlignVCenter
Button { onClicked: {
id: loginB // Create and show a new window
anchors { var newWindow = newWindowComponent.createObject(null, { authToken: authToken });
verticalCenter: s1.verticalCenter if (newWindow !== null) {
rightMargin: 10 newWindow.show();
right: s1.right } else {
console.log("Failed to create new window");
}
}
} }
text: qsTr("Logout")
onClicked: { Button {
logout(); id: loginB
} text: qsTr("Logout")
} Layout.alignment: Qt.AlignVCenter
onClicked: {
Button { logout();
text: qsTr("Add License")
anchors {
verticalCenter: s1.verticalCenter
rightMargin: 10
right: loginB.left
}
onClicked: {
// Create and show a new window
var newWindow = newWindowComponent.createObject(null, { authToken: authToken });
if (newWindow !== null) {
newWindow.show();
} else {
console.log("Failed to create new window");
} }
} }
} }
@ -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
} }
} }
} }