From 41ecdb658c56a17dfe642ab0665e41a3374c2eb679c511b901cef801b1fccbb5 Mon Sep 17 00:00:00 2001 From: Yuri Becker Date: Mon, 24 Mar 2025 11:29:11 +0100 Subject: [PATCH 1/3] Fix Objects Table --- Gui/ObjectTable.qml | 2 +- Gui/ObjectsTable.qml | 202 ++++++++++++++++++++----------------------- 2 files changed, 93 insertions(+), 111 deletions(-) diff --git a/Gui/ObjectTable.qml b/Gui/ObjectTable.qml index 8fc8d48..19c9865 100644 --- a/Gui/ObjectTable.qml +++ b/Gui/ObjectTable.qml @@ -5,13 +5,13 @@ import Qt.labs.qmlmodels Item { property var availableFilters: [""] + anchors.fill: parent StackView { id: objectsStack anchors.fill: parent initialItem: "ObjectsTable.qml" - anchors.margins: 9 } } diff --git a/Gui/ObjectsTable.qml b/Gui/ObjectsTable.qml index 7082119..3e4f772 100644 --- a/Gui/ObjectsTable.qml +++ b/Gui/ObjectsTable.qml @@ -3,154 +3,136 @@ import QtQuick.Layouts import QtQuick.Controls import Qt.labs.qmlmodels -Item -{ - SearchBar - { - id:searchBar - anchors.margins: 9 +ColumnLayout { + spacing: Dimensions.l + function onObjectContactAdded(added) { + console.log(added); + if (added) + object_model.viewCriterion(""); } - Button - { - id: addObjectBtn - icon.source: "qrc:/images/PlusCircle.svg" - text: qsTr("Objekt Hinzufügen") - anchors.right: parent.right - onClicked: appLoader.source = "AddObject.qml" + Component.onCompleted: { + contact_model.objectContactAdded.connect(onObjectContactAdded); + objectsStack.pop(); } + RowLayout { + Layout.fillWidth: true + spacing: Dimensions.l - ColumnLayout - { - id: tableColumn - clip: true - anchors - { - top: searchBar.bottom - bottom: parent.bottom - left: parent.left - right: parent.right - topMargin: 15 + SearchBar { } - HorizontalHeaderView - { + + Button { + id: addObjectBtn + Layout.alignment: Qt.AlignRight + + icon.source: "qrc:/images/PlusCircle.svg" + text: qsTr("Objekt Hinzufügen") + + onClicked: appLoader.source = "AddObject.qml" + } + } + ColumnLayout { + id: tableColumn + Layout.fillWidth: true + Layout.fillHeight: true + Layout.verticalStretchFactor: 1 + + clip: true + + HorizontalHeaderView { id: horizontalHeaderview + Layout.fillWidth: true implicitHeight: 40 - //visible: false movableColumns: true //@disable-check M16 syncView: objectTable delegate: Rectangle { - color: addObjectBtn.palette.alternateBase - border.color: addObjectBtn.palette.base - implicitHeight: 40 - Layout.fillWidth: true - implicitWidth: 1 - Text - { - text: model.display - elide: Text.ElideRight - width: parent.width - height: parent.height - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - color: addObjectBtn.palette.text - } + Layout.fillWidth: true + border.color: addObjectBtn.palette.base + color: addObjectBtn.palette.alternateBase + implicitHeight: 40 + implicitWidth: 1 + + Text { + color: addObjectBtn.palette.text + elide: Text.ElideRight + height: parent.height + horizontalAlignment: Text.AlignHCenter + text: model.display + verticalAlignment: Text.AlignVCenter + width: parent.width + } } } - - TableView - { - property real newWidth: 0 + TableView { id: objectTable - z: 0 - height: tableColumn.height - horizontalHeaderview.height + + property real newWidth: 0 + Layout.fillWidth: true - columnSpacing: 1 - rowSpacing: 2 - model: object_model + Layout.fillHeight: true alternatingRows: true + columnSpacing: 1 + height: parent.height - horizontalHeaderview.height + model: object_model resizableColumns: true // @disable-check M16 + rowSpacing: 2 selectionBehavior: TableView.SelectRows - ScrollBar.vertical: ScrollBar - { + z: 0 + + ScrollBar.vertical: ScrollBar { policy: objectTable.contentHeight > objectTable.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff } - selectionModel: ItemSelectionModel - { - id: obmodel - model: objectTable.model - } - - delegate:Rectangle - { - required property bool selected + delegate: Rectangle { required property bool current - implicitWidth: objectTable.width / objectTable.columns + required property bool selected + + color: selected ? addObjectBtn.palette.highlight + : (objectTable.alternatingRows && row % 2 !== 0 ? addObjectBtn.palette.base + : addObjectBtn.palette.alternateBase) + implicitHeight: 25 - color: selected - ? addObjectBtn.palette.highlight //palette.highlight - : (objectTable.alternatingRows && row % 2 !== 0 - ? addObjectBtn.palette.base // palette.base - : addObjectBtn.palette.alternateBase) //palette.alternateBase) + implicitWidth: objectTable.width / objectTable.columns - Text - { - text: (model.display === null || model.display === undefined)? "": model.display - elide: Text.ElideRight - width: parent.width - height: parent.height - verticalAlignment: Text.AlignVCenter - leftPadding: 9 //@d isable-check M16 + Text { color: addObjectBtn.palette.text + elide: Text.ElideRight + height: parent.height + leftPadding: 9 //@disable-check M16 + text: (model.display === null || model.display === undefined) ? "" : model.display + verticalAlignment: Text.AlignVCenter + width: parent.width } - - MouseArea - { - property bool hovered: false + MouseArea { id: mouseArea + + property bool hovered: false + anchors.fill: parent hoverEnabled: true - onDoubleClicked: - { - objectsStack.push("ObjectDetails.qml", {selectedObject: row}); + + onDoubleClicked: { + objectsStack.push("ObjectDetails.qml", { + selectedObject: row + }); } - onEntered: - { - objectTable.selectionModel.select(objectTable.model.index(row, 0), ItemSelectionModel.SelectCurrent | ItemSelectionModel.Rows) + onEntered: { + objectTable.selectionModel.select(objectTable.model.index(row, 0), ItemSelectionModel.SelectCurrent | ItemSelectionModel.Rows); } } } - // onContentWidthChanged: - // { + selectionModel: ItemSelectionModel { + id: obmodel - // redrawTable.start() - // } + model: objectTable.model + } } - - Item - { - + Item { Layout.fillWidth: true } } - // function viewCriterion(criterion) - // { - // object_model.viewCriterion(criterion.text) - // } - - Component.onCompleted: - { - contact_model.objectContactAdded.connect(onObjectContactAdded) - objectsStack.pop() - } - - function onObjectContactAdded(added) - { - console.log(added) - if (added) object_model.viewCriterion("") - } } From 30493dbdbf2e999a55dc758df5b2d125674f21e5bd82f08b17dbebb0a88da3a3 Mon Sep 17 00:00:00 2001 From: Yuri Becker Date: Mon, 24 Mar 2025 11:41:07 +0100 Subject: [PATCH 2/3] Fix Offers View --- Gui/OfferTable.qml | 5 +++-- Gui/OffersTable.qml | 17 +++++++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Gui/OfferTable.qml b/Gui/OfferTable.qml index 7f16a20..519ceed 100644 --- a/Gui/OfferTable.qml +++ b/Gui/OfferTable.qml @@ -6,12 +6,13 @@ import Qt.labs.qmlmodels Item { + anchors.fill: parent StackView { - id: employeesStack + id: offersStack + anchors.fill: parent initialItem: "OffersTable.qml" - anchors.margins: 9 } } diff --git a/Gui/OffersTable.qml b/Gui/OffersTable.qml index 8c64582..99161b4 100644 --- a/Gui/OffersTable.qml +++ b/Gui/OffersTable.qml @@ -3,13 +3,18 @@ import QtQuick.Layouts import QtQuick.Controls import Qt.labs.qmlmodels -Item -{ +ColumnLayout { property var availableFilters: [] - SearchBar - { - id:searchBar - anchors.margins: 9 + Layout.fillWidth: true + anchors.fill: parent + + RowLayout { + spacing: Dimensions.l + SearchBar { + } + } + Item { + Layout.fillHeight: true } } From 7f5675c06d72728a2249b66dc18d56221ad5a0c97791edbc86afeb57dcb3392d Mon Sep 17 00:00:00 2001 From: Yuri Becker Date: Mon, 24 Mar 2025 12:06:09 +0100 Subject: [PATCH 3/3] Add Hover Effect to Buttons --- TeroStyle/Button.qml | 2 +- TeroStyle/Colors.qml | 7 ++++--- TeroStyle/QuickFilter.qml | 6 +++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/TeroStyle/Button.qml b/TeroStyle/Button.qml index c96c7cf..2810636 100644 --- a/TeroStyle/Button.qml +++ b/TeroStyle/Button.qml @@ -43,7 +43,7 @@ T.Button { border.color: Colors.interactive border.width: isFieldButton ? 1 : 0 bottomLeftRadius: topLeftRadius - color: Colors.primary + color: !control.hovered ? Colors.primary : Colors.primaryLighter radius: Dimensions.radius topLeftRadius: isFieldButton ? 0 : radius } diff --git a/TeroStyle/Colors.qml b/TeroStyle/Colors.qml index 3706c3c..bcc1df6 100644 --- a/TeroStyle/Colors.qml +++ b/TeroStyle/Colors.qml @@ -8,9 +8,10 @@ QtObject { property int theme: Application.styleHints.colorScheme === Qt.ColorScheme.Light ? light : dark - property color primary: "#b81a34" - property color primaryContrast: "#fdfdfd" - property color foreground: theme === dark ? "#fdfdfd" : "#110b0c" + readonly property color primary: "#b81a34" + readonly property color primaryContrast: "#fdfdfd" + readonly property color primaryLighter: Qt.lighter(primary, 1.5) + readonly property color foreground: theme === dark ? "#fdfdfd" : "#110b0c" readonly property color background: theme === dark ? "#303136" : "#eff1f5" readonly property color mantle: theme === dark ? "#1e1f22" : "#e7e9ef" readonly property color interactive: theme === dark ? "#878b97" : "#d9d9da" diff --git a/TeroStyle/QuickFilter.qml b/TeroStyle/QuickFilter.qml index e7b1113..05745f4 100644 --- a/TeroStyle/QuickFilter.qml +++ b/TeroStyle/QuickFilter.qml @@ -19,6 +19,7 @@ RowLayout { required property int index required property var modelData + property bool hovered: false property real padding: Dimensions.m height: text.height + padding * 2 @@ -28,7 +29,7 @@ RowLayout { anchors.fill: parent border.color: modelData.selected ? Colors.transparent : Colors.foreground border.width: 2 - color: modelData.selected ? Colors.primary : Colors.transparent + color: modelData.selected || mouseArea.containsMouse ? Colors.primary : Colors.transparent radius: parent.height } Text { @@ -41,6 +42,9 @@ RowLayout { y: parent.padding } MouseArea { + id: mouseArea + + hoverEnabled: true anchors.fill: parent cursorShape: Qt.PointingHandCursor