native: convert from list to table
This commit is contained in:
parent
6c48ccd73b
commit
d2c50fc2e5
1 changed files with 28 additions and 38 deletions
|
@ -1,17 +1,16 @@
|
||||||
import QtQuick 2.15
|
import QtQuick 2.15
|
||||||
import QtQuick.Window 2.15
|
|
||||||
import QtQuick.Layouts 2.15
|
|
||||||
import QtQuick.Controls 2.15
|
import QtQuick.Controls 2.15
|
||||||
|
import QtQuick.Layouts 2.15
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
visible: true
|
id: root
|
||||||
|
|
||||||
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 }
|
||||||
|
|
||||||
function getColors() {
|
function getColors() {
|
||||||
return root.active ? activeColors : inactiveColors;
|
return active ? activeColors : inactiveColors;
|
||||||
}
|
}
|
||||||
|
|
||||||
property string authToken: ""
|
property string authToken: ""
|
||||||
|
@ -99,54 +98,46 @@ Rectangle {
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: header
|
height: 50
|
||||||
|
width: parent.width
|
||||||
color: getColors().midlight
|
color: getColors().midlight
|
||||||
height: 40
|
|
||||||
Layout.fillWidth: true
|
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
spacing: 10
|
spacing: 10
|
||||||
anchors.margins: 5
|
anchors.margins: 5
|
||||||
|
|
||||||
Text { text: qsTr("Name"); color: getColors().text; Layout.fillWidth: true }
|
Text { text: qsTr("Name"); color: getColors().text; Layout.preferredWidth: 150; font.bold: true }
|
||||||
Text { text: qsTr("Key"); color: getColors().text; Layout.fillWidth: true }
|
Text { text: qsTr("Key"); color: getColors().text; Layout.preferredWidth: 150; font.bold: true }
|
||||||
Text { text: qsTr("Amount"); color: getColors().text; Layout.fillWidth: true }
|
Text { text: qsTr("Amount"); color: getColors().text; Layout.preferredWidth: 100; font.bold: true }
|
||||||
Text { text: qsTr("Start"); color: getColors().text; Layout.fillWidth: true }
|
Text { text: qsTr("Start"); color: getColors().text; Layout.preferredWidth: 100; font.bold: true }
|
||||||
Text { text: qsTr("End"); color: getColors().text; Layout.fillWidth: true }
|
Text { text: qsTr("End"); color: getColors().text; Layout.preferredWidth: 100; font.bold: true }
|
||||||
Text { text: qsTr("Group"); color: getColors().text; Layout.fillWidth: true }
|
Text { text: qsTr("Group"); color: getColors().text; Layout.preferredWidth: 150; font.bold: true }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollView {
|
ListView {
|
||||||
|
id: listView
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
model: filteredApiDataModel // Use the filtered model
|
||||||
|
|
||||||
ListView {
|
delegate: Rectangle {
|
||||||
id: listView
|
width: listView.width
|
||||||
Layout.fillWidth: true
|
height: 50
|
||||||
Layout.fillHeight: true
|
color: (index % 2 === 0) ? getColors().button : getColors().highlight // Alternating row colors
|
||||||
clip: true
|
|
||||||
boundsBehavior: Flickable.StopAtBounds
|
|
||||||
model: filteredApiDataModel // Use the filtered model
|
|
||||||
|
|
||||||
delegate: Rectangle {
|
RowLayout {
|
||||||
width: listView.width
|
anchors.fill: parent
|
||||||
height: 50
|
spacing: 10
|
||||||
color: (index % 2 === 0) ? getColors().button : getColors().highlight // Alternating row colors
|
anchors.margins: 5
|
||||||
|
|
||||||
RowLayout {
|
Text { text: model.name; color: getColors().text; Layout.preferredWidth: 150; elide: Text.ElideRight }
|
||||||
anchors.fill: parent
|
Text { text: model.key; color: getColors().text; Layout.preferredWidth: 150; elide: Text.ElideRight }
|
||||||
spacing: 10
|
Text { text: model.amount; color: getColors().text; Layout.preferredWidth: 100; elide: Text.ElideRight }
|
||||||
anchors.margins: 5
|
Text { text: model.start; color: getColors().text; Layout.preferredWidth: 100; elide: Text.ElideRight }
|
||||||
|
Text { text: model.end; color: getColors().text; Layout.preferredWidth: 100; elide: Text.ElideRight }
|
||||||
Text { text: model.name; color: getColors().text; Layout.fillWidth: true }
|
Text { text: model.group; color: getColors().text; Layout.preferredWidth: 150; elide: Text.ElideRight }
|
||||||
Text { text: model.key; color: getColors().text; Layout.fillWidth: true }
|
|
||||||
Text { text: model.amount; color: getColors().text; Layout.fillWidth: true }
|
|
||||||
Text { text: model.start; color: getColors().text; Layout.fillWidth: true }
|
|
||||||
Text { text: model.end; color: getColors().text; Layout.fillWidth: true }
|
|
||||||
Text { text: model.group; color: getColors().text; Layout.fillWidth: true }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -197,7 +188,6 @@ Rectangle {
|
||||||
amount: jsonResponse[i].licenses[ii].amount ? jsonResponse[i].licenses[ii].amount.toString() : "∞",
|
amount: jsonResponse[i].licenses[ii].amount ? jsonResponse[i].licenses[ii].amount.toString() : "∞",
|
||||||
key: jsonResponse[i].licenses[ii].key
|
key: jsonResponse[i].licenses[ii].key
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
filterModel() // Filter the model after loading data
|
filterModel() // Filter the model after loading data
|
||||||
|
|
Loading…
Reference in a new issue