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

View File

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