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,
key: keyT.text,
amount: parseInt(amountT.text),
group_id: "f7604976-1e3c-49b7-841b-6a4025257c70",
group_id: "ff664d29-68c9-45c2-a6bc-8f378876c90d",
});
xhr.send(data);

View file

@ -4,6 +4,8 @@ import QtQuick.Layouts 2.15
import QtQuick.Controls 2.15
Rectangle {
visible: true
SystemPalette { id: activeColors; colorGroup: SystemPalette.Active }
SystemPalette { id: inactiveColors; colorGroup: SystemPalette.Inactive }
SystemPalette { id: disabledColors; colorGroup: SystemPalette.Disabled }
@ -26,44 +28,37 @@ Rectangle {
height: 50
color: getColors().midlight
TextField {
anchors {
verticalCenter: s1.verticalCenter
rightMargin: 5
right: loginB.left
RowLayout {
anchors.fill: parent
spacing: 10
anchors.margins: 5
TextField {
placeholderText: qsTr("Search")
Layout.alignment: Qt.AlignVCenter
Layout.fillWidth: true
}
placeholderText: qsTr("Search")
}
Button {
id: loginB
anchors {
verticalCenter: s1.verticalCenter
rightMargin: 10
right: s1.right
Button {
text: qsTr("Add License")
Layout.alignment: Qt.AlignVCenter
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");
}
}
}
text: qsTr("Logout")
onClicked: {
logout();
}
}
Button {
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");
Button {
id: loginB
text: qsTr("Logout")
Layout.alignment: Qt.AlignVCenter
onClicked: {
logout();
}
}
}
@ -84,46 +79,55 @@ Rectangle {
}
ListView {
anchors {
topMargin: 5
fill: s2
}
id: listView
anchors.fill: parent
clip: true
boundsBehavior: Flickable.StopAtBounds
model: apiDataModel
delegate: Item {
width: parent.width
delegate: Rectangle {
width: listView.width
height: 50
color: getColors().button
Row {
RowLayout {
anchors.fill: parent
spacing: 10
Text {
text: model.name
color: getColors().text
Layout.alignment: Qt.AlignVCenter
}
Text {
text: model.key
color: getColors().text
Layout.alignment: Qt.AlignVCenter
}
Text {
text: model.amount
color: getColors().text
Layout.alignment: Qt.AlignVCenter
}
Text {
text: model.start
color: getColors().text
Layout.alignment: Qt.AlignVCenter
}
Text {
text: model.end
color: getColors().text
Layout.alignment: Qt.AlignVCenter
}
Text {
text: model.group
color: getColors().text
Layout.alignment: Qt.AlignVCenter
}
}
}