some more experiments

This commit is contained in:
Blue 2024-04-09 18:04:07 -03:00
parent 9b7cea725f
commit cdde0b9e2e
Signed by: blue
GPG Key ID: 9B203B252A63EE38
3 changed files with 48 additions and 100 deletions

View File

@ -44,77 +44,6 @@ Item {
onRemove: id => item.remove(id)
onEdit: id => item.edit(id)
}
// model: TableModel {
// TableModelColumn { display: "icon"; decoration: "color" }
// TableModelColumn { display: "title" }
// TableModelColumn { display: "balance" }
// TableModelColumn { display: "currency" }
// TableModelColumn { display: "assetID" }
// TableModelColumn { display: "assetID" }
// }
// delegate: DelegateChooser {
// property int iconSize: 40
// DelegateChoice {
// column: 0
// delegate: Rectangle {
// implicitWidth: iconSize
// implicitHeight: iconSize
// color: model.decoration
// Components.Icon {
// anchors.fill: parent
// anchors.margins: 2
// iconName: model.display
// color: pickColor(model.decoration)
// }
// }
// }
// DelegateChoice {
// column: 1
// delegate: Label {
// text: model.display
// verticalAlignment: Text.AlignVCenter
// font.bold: true
// }
// }
// DelegateChoice {
// column: 2
// delegate: Label {
// text: model.display
// verticalAlignment: Text.AlignVCenter
// }
// }
// DelegateChoice {
// column: 3
// delegate: Label {
// text: model.display
// verticalAlignment: Text.AlignVCenter
// }
// }
// DelegateChoice {
// column: 4
// delegate: Button {
// text: qsTr("Edit")
// icon.name: "entry-edit"
// flat: true
// onClicked: edit(model.display)
// }
// }
// DelegateChoice {
// column: 5
// delegate: Button {
// text: qsTr("Delete")
// icon.name: "delete"
// onClicked: remove(model.display)
// palette { //unfortunately doesn't work anymore
// button: "red"
// }
// }
// }
// }
}
}

View File

@ -16,14 +16,10 @@ Item {
Column {
id: menu
// Layout.fillWidth: true
// Layout.minimumWidth: 50
Layout.preferredWidth: children[3].implicitWidth
// Layout.maximumWidth: 100
Layout.alignment: Qt.AlignTop
MenuItem {
width: parent.width
width: Math.max(parent.implicitWidth, implicitWidth)
text: qsTr("Home")
icon.name: "home"
highlighted: currentPage === "home"
@ -33,7 +29,7 @@ Item {
}
}
MenuItem {
width: parent.width
width: Math.max(parent.implicitWidth, implicitWidth)
text: qsTr("Assets")
icon.name: "document-properties"
highlighted: currentPage === "assets"
@ -43,7 +39,7 @@ Item {
}
}
MenuItem {
width: parent.width
width: Math.max(parent.implicitWidth, implicitWidth)
text: qsTr("Records")
icon.name: "system-search"
highlighted: currentPage === "records"
@ -54,7 +50,7 @@ Item {
}
MenuItem {
width: parent.width
width: Math.max(parent.implicitWidth, implicitWidth)
text: qsTr("Currencies")
icon.name: "format-currency"
highlighted: currentPage === "currencies"
@ -73,32 +69,57 @@ Item {
Component {
id: home
Home {
Item {
StackView.onActivating: currentPage = "home"
Home {
anchors {
fill: parent
margins: 5
}
}
}
}
Component {
id: assets
Assets {
Item {
StackView.onActivating: currentPage = "assets"
onAdd: addAsset()
onRemove: id => removeAsset(id)
onEdit: id => editAsset(id)
Assets {
anchors {
fill: parent
margins: 5
}
onAdd: addAsset()
onRemove: id => removeAsset(id)
onEdit: id => editAsset(id)
}
}
}
Component {
id: records
Records {
Item {
StackView.onActivating: currentPage = "records"
Records {
anchors {
fill: parent
margins: 5
}
}
}
}
Component {
id: currencies
Currencies {
Item {
StackView.onActivating: currentPage = "currencies"
Currencies {
anchors {
fill: parent
margins: 5
}
}
}
}
}

View File

@ -3,6 +3,7 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import magpie
@ -18,16 +19,13 @@ Item {
signal remove(id: int)
signal edit(id: int)
Row {
readonly property int iconSize: height
readonly property int freespace: width - deleteButton.width - editButton.width - iconSize - spacing * children.length - 1
RowLayout {
anchors.fill: parent
spacing: 5
Rectangle {
width: parent.iconSize
height: parent.iconSize
Layout.preferredWidth: parent.height
Layout.fillHeight: true
color: line.color
Icon {
@ -39,41 +37,41 @@ Item {
}
Label {
width: parent.freespace / 3
height: parent.height
Layout.fillHeight: true
Layout.preferredWidth: Infinity
text: title
verticalAlignment: Text.AlignVCenter
font.bold: true
}
Label {
width: parent.freespace / 3
height: parent.height
Layout.fillHeight: true
Layout.preferredWidth: Infinity
text: balance
verticalAlignment: Text.AlignVCenter
}
Label {
width: parent.freespace / 3
height: parent.height
Layout.fillHeight: true
Layout.preferredWidth: Infinity
text: currency
verticalAlignment: Text.AlignVCenter
}
Button {
id: editButton
Layout.fillHeight: true
text: qsTr("Edit")
icon.name: "entry-edit"
flat: true
height: parent.height
onClicked: edit(assetID)
}
Button {
id: deleteButton
Layout.fillHeight: true
text: qsTr("Delete")
icon.name: "delete"
height: parent.height
onClicked: remove(assetID)
palette { //unfortunately doesn't work anymore
button: "red"