From cdde0b9e2ecd4472d9908f1234b438a7b4029cc3 Mon Sep 17 00:00:00 2001 From: blue Date: Tue, 9 Apr 2024 18:04:07 -0300 Subject: [PATCH] some more experiments --- qml/Application/Assets.qml | 71 ------------------------------------ qml/Application/Main.qml | 51 ++++++++++++++++++-------- qml/Components/AssetLine.qml | 26 ++++++------- 3 files changed, 48 insertions(+), 100 deletions(-) diff --git a/qml/Application/Assets.qml b/qml/Application/Assets.qml index 2c2d6ca..c6b0145 100644 --- a/qml/Application/Assets.qml +++ b/qml/Application/Assets.qml @@ -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" - // } - // } - // } - // } } } diff --git a/qml/Application/Main.qml b/qml/Application/Main.qml index 901ee2c..033b3b1 100644 --- a/qml/Application/Main.qml +++ b/qml/Application/Main.qml @@ -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 + } + } } } } diff --git a/qml/Components/AssetLine.qml b/qml/Components/AssetLine.qml index 5569e05..1837755 100644 --- a/qml/Components/AssetLine.qml +++ b/qml/Components/AssetLine.qml @@ -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"