From dc1ea604f7d786efb0016fcb0764479e26e6495b2963a677504187f29301d86e Mon Sep 17 00:00:00 2001 From: Yuri Becker Date: Thu, 20 Mar 2025 13:03:46 +0100 Subject: [PATCH] Add Icons to Buttons --- Gui/AddCustomer.qml | 1 - Gui/AddObject.qml | 1 - Gui/CustomerTable.qml | 1 - Gui/CustomerView.qml | 1 - Gui/CustomersTable.qml | 190 ++++++++++++++-------------- Gui/EmployeesTable.qml | 4 +- Gui/LoginScreen.qml | 11 +- Gui/ObjectTable.qml | 1 - Gui/ObjectsTable.qml | 6 +- Gui/SearchBar.qml | 6 +- Gui/TopBar.qml | 3 +- TeroStyle/Button.qml | 40 ++++-- images/ArrowRightEndOnRectangle.svg | 4 + images/Bars3.svg | 3 + images/ChevronDown.svg | 4 +- images/Funnel.svg | 3 + images/MagnifyingGlass.svg | 3 + images/PlusCircle.svg | 3 + images/README.md | 6 + images/account.svg | 1 - images/add.svg | 1 - images/addbusiness.svg | 1 - images/addoffer.svg | 1 - images/addperson.svg | 1 - images/filter.svg | 1 - images/menu.svg | 1 - images/search.svg | 1 - pyqcrm.qrc | 14 +- 28 files changed, 164 insertions(+), 149 deletions(-) create mode 100644 images/ArrowRightEndOnRectangle.svg create mode 100644 images/Bars3.svg create mode 100644 images/Funnel.svg create mode 100644 images/MagnifyingGlass.svg create mode 100644 images/PlusCircle.svg create mode 100644 images/README.md delete mode 100644 images/account.svg delete mode 100644 images/add.svg delete mode 100644 images/addbusiness.svg delete mode 100644 images/addoffer.svg delete mode 100644 images/addperson.svg delete mode 100644 images/filter.svg delete mode 100644 images/menu.svg delete mode 100644 images/search.svg diff --git a/Gui/AddCustomer.qml b/Gui/AddCustomer.qml index c273d22..fca1a07 100644 --- a/Gui/AddCustomer.qml +++ b/Gui/AddCustomer.qml @@ -1,7 +1,6 @@ import QtQuick import QtQuick.Layouts import QtQuick.Controls -import QtQuick.Controls.Fusion import QtQuick.Dialogs import "../js/qmldict.js" as JsLib diff --git a/Gui/AddObject.qml b/Gui/AddObject.qml index b95d244..dd061bb 100644 --- a/Gui/AddObject.qml +++ b/Gui/AddObject.qml @@ -1,7 +1,6 @@ import QtQuick import QtQuick.Layouts import QtQuick.Controls -import QtQuick.Controls.Fusion import QtQuick.Dialogs import "../js/qmldict.js" as JsLib diff --git a/Gui/CustomerTable.qml b/Gui/CustomerTable.qml index c00a91c..48afca3 100644 --- a/Gui/CustomerTable.qml +++ b/Gui/CustomerTable.qml @@ -2,7 +2,6 @@ import QtQuick import QtQuick.Layouts import QtQuick.Controls import Qt.labs.qmlmodels -import QtQuick.Controls.Fusion Item { anchors.fill: parent diff --git a/Gui/CustomerView.qml b/Gui/CustomerView.qml index 2b5f8a3..4479962 100644 --- a/Gui/CustomerView.qml +++ b/Gui/CustomerView.qml @@ -20,7 +20,6 @@ GridLayout Layout.alignment: Qt.AlignRight | Qt.AlignVCenter } - TextField { property string name: "business" diff --git a/Gui/CustomersTable.qml b/Gui/CustomersTable.qml index c258084..a74f454 100644 --- a/Gui/CustomersTable.qml +++ b/Gui/CustomersTable.qml @@ -2,176 +2,170 @@ import QtQuick import QtQuick.Layouts import QtQuick.Controls import Qt.labs.qmlmodels -import QtQuick.Controls.Fusion -Item -{ - SearchBar - { - id:searchBar +Item { + function viewCriterion(criterion) { + business_model.viewCriterion(criterion.text); + } + + Component.onCompleted: customersStack.pop() + + SearchBar { + id: searchBar + anchors.margins: 9 } - Button - { - id: addBusinessBtn - icon.source: "qrc:/images/addbusiness.svg" - icon.color: "olive" + Button { + id: addCustomer + anchors.right: parent.right - flat: true + icon.source: "qrc:/images/PlusCircle.svg" + text: qsTr("Kunde hinzufügen") + onClicked: appLoader.source = "AddCustomer.qml" } - - ColumnLayout - { + ColumnLayout { id: tableColumn + clip: true - anchors - { - top: searchBar.bottom + + anchors { bottom: parent.bottom left: parent.left right: parent.right + top: searchBar.bottom } - - RowLayout - { + RowLayout { id: sortView - RadioButton - { + + RadioButton { id: showAll + checked: true text: qsTr("Alle") + onClicked: viewCriterion(showAll) } - RadioButton - { + RadioButton { id: showInterested - text: qsTr("Interessent") - onClicked: viewCriterion(showInterested) + + text: qsTr("Interessent") + + onClicked: viewCriterion(showInterested) } - RadioButton - { + RadioButton { id: showClientele + text: qsTr("Kunden") onClicked: viewCriterion(showClientele) } - RadioButton - { + RadioButton { id: showProvider + text: qsTr("Lieferant") + onClicked: viewCriterion(showProvider) } - RadioButton - { + RadioButton { id: showFinished + text: qsTr("Erledigt") + onClicked: viewCriterion(showFinished) } } - - HorizontalHeaderView - { + HorizontalHeaderView { id: horizontalHeader + Layout.fillWidth: true implicitHeight: 40 movableColumns: true //@disable-check M16 syncView: customerTable - delegate: Rectangle - { - color: addBusinessBtn.palette.alternateBase - border.color: addBusinessBtn.palette.base - implicitHeight: 40 + + delegate: Rectangle { Layout.fillWidth: true + border.color: addCustomer.palette.base + color: addCustomer.palette.alternateBase + implicitHeight: 40 implicitWidth: 1 - Text - { - text: model.display + + Text { + color: addCustomer.palette.text elide: Text.ElideRight - width: parent.width height: parent.height horizontalAlignment: Text.AlignHCenter + text: model.display verticalAlignment: Text.AlignVCenter - color: addBusinessBtn.palette.text + width: parent.width } } } - - TableView - { - property real newWidth: 0 + TableView { id: customerTable - z: 1 + + property real newWidth: 0 + Layout.fillHeight: true //height: tableColumn.height - (sortView.height + horizontalHeader.height) Layout.fillWidth: true - columnSpacing: 1 - rowSpacing: 2 - model: business_model alternatingRows: true + columnSpacing: 1 + model: business_model resizableColumns: true + rowSpacing: 2 selectionBehavior: TableView.SelectRows - ScrollBar.vertical: ScrollBar - { + z: 1 + + ScrollBar.vertical: ScrollBar { policy: customerTable.contentHeight > customerTable.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff } - - selectionModel: ItemSelectionModel - { - id: selModel - model: customerTable.model - } - delegate:Rectangle - { - required property bool selected + delegate: Rectangle { required property bool current - implicitWidth: customerTable.width / customerTable.columns + required property bool selected + + color: selected ? addCustomer.palette.highlight //palette.highlight + : (customerTable.alternatingRows && row % 2 !== 0 ? addCustomer.palette.base // palette.base + : addCustomer.palette.alternateBase) //palette.alternateBase) implicitHeight: 25 - color: selected - ? addBusinessBtn.palette.highlight //palette.highlight - : (customerTable.alternatingRows && row % 2 !== 0 - ? addBusinessBtn.palette.base // palette.base - : addBusinessBtn.palette.alternateBase) //palette.alternateBase) - Text - { - text: model.display == null? "": model.display // @disable-check M126 + implicitWidth: customerTable.width / customerTable.columns + + Text { + color: addCustomer.palette.text elide: Text.ElideRight - width: parent.width height: parent.height - verticalAlignment: Text.AlignVCenter leftPadding: 9 - color: addBusinessBtn.palette.text + text: model.display == null ? "" : model.display // @disable-check M126 + verticalAlignment: Text.AlignVCenter + width: parent.width } - MouseArea - { - property bool hovered: false + MouseArea { id: mouseArea + + property bool hovered: false + anchors.fill: parent hoverEnabled: true - onDoubleClicked: - { - business_model.onRowClicked(row) - customersStack.push("CustomerDetails.qml", {selectedClient: row}); - } - onEntered: - { - customerTable.selectionModel.select(customerTable.model.index(row, 0), ItemSelectionModel.SelectCurrent | ItemSelectionModel.Rows) + onDoubleClicked: { + business_model.onRowClicked(row); + customersStack.push("CustomerDetails.qml", { + selectedClient: row + }); + } + onEntered: { + customerTable.selectionModel.select(customerTable.model.index(row, 0), ItemSelectionModel.SelectCurrent | ItemSelectionModel.Rows); } } } - } + selectionModel: ItemSelectionModel { + id: selModel - Item - { + model: customerTable.model + } + } + Item { Layout.fillWidth: true } } - - function viewCriterion(criterion) - { - business_model.viewCriterion(criterion.text) - } - - Component.onCompleted: customersStack.pop() } diff --git a/Gui/EmployeesTable.qml b/Gui/EmployeesTable.qml index 2a7a4f2..aaffbec 100644 --- a/Gui/EmployeesTable.qml +++ b/Gui/EmployeesTable.qml @@ -16,8 +16,8 @@ Item Button { id: addEmployeeBtn - icon.source: "qrc:/images/addbusiness.svg" - icon.color: "olive" + text: qsTr("Mitarbeiter Hinzufügen") + icon.source: "qrc:/images/PlusCircle.svg" anchors.right: parent.right flat: true onClicked: appLoader.source = "AddApplicant.qml" diff --git a/Gui/LoginScreen.qml b/Gui/LoginScreen.qml index c3cc942..f6517f6 100644 --- a/Gui/LoginScreen.qml +++ b/Gui/LoginScreen.qml @@ -32,16 +32,15 @@ Item { } ColumnLayout { - spacing: Dimensions.m anchors.centerIn: parent + spacing: Dimensions.m Label { - font: Typography.h1 - text: qsTr("Login") Layout.alignment: Qt.AlignHCenter Layout.bottomMargin: Dimensions.l + font: Typography.h1 + text: qsTr("Login") } - Field { label: qsTr("Benutzername") @@ -78,11 +77,11 @@ Item { } } } - Button { Layout.topMargin: Dimensions.m + implicitWidth: parent.width + icon.source: "qrc:/images/ArrowRightEndOnRectangle.svg" text: qsTr("Login") - width: parent.width onClicked: { if (benutzerName.text.trim() && passwort.text.trim()) diff --git a/Gui/ObjectTable.qml b/Gui/ObjectTable.qml index aee6002..8fc8d48 100644 --- a/Gui/ObjectTable.qml +++ b/Gui/ObjectTable.qml @@ -2,7 +2,6 @@ import QtQuick import QtQuick.Layouts import QtQuick.Controls import Qt.labs.qmlmodels -import QtQuick.Controls.Fusion Item { property var availableFilters: [""] diff --git a/Gui/ObjectsTable.qml b/Gui/ObjectsTable.qml index 71196e4..7082119 100644 --- a/Gui/ObjectsTable.qml +++ b/Gui/ObjectsTable.qml @@ -2,7 +2,6 @@ import QtQuick import QtQuick.Layouts import QtQuick.Controls import Qt.labs.qmlmodels -import QtQuick.Controls.Fusion Item { @@ -15,10 +14,9 @@ Item Button { id: addObjectBtn - icon.source: "qrc:/images/addbusiness.svg" - icon.color: "olive" + icon.source: "qrc:/images/PlusCircle.svg" + text: qsTr("Objekt Hinzufügen") anchors.right: parent.right - flat: true onClicked: appLoader.source = "AddObject.qml" } diff --git a/Gui/SearchBar.qml b/Gui/SearchBar.qml index 83a942b..0e5c124 100644 --- a/Gui/SearchBar.qml +++ b/Gui/SearchBar.qml @@ -18,8 +18,7 @@ RowLayout Button { - icon.source: "qrc:/images/search.svg" - icon.color: "olive" + icon.source: "qrc:/images/MagnifyingGlass.svg" x: parent.x + parent.width - width height: parent.height flat: true @@ -29,8 +28,7 @@ RowLayout Button { id: filterBtn - icon.source: "qrc:/images/filter.svg" - icon.color: "olive" + icon.source: "qrc:/images/Funnel.svg" x: parent.x + parent.width height: searchField.height flat: true diff --git a/Gui/TopBar.qml b/Gui/TopBar.qml index 3af0fae..2206daf 100644 --- a/Gui/TopBar.qml +++ b/Gui/TopBar.qml @@ -199,8 +199,7 @@ RowLayout Button { id: atajos - icon.source: "qrc:/images/menu.svg" - icon.color: "red" + icon.source: "qrc:/images/Bars3.svg" flat: true Layout.rightMargin: 9 onClicked: mainMenu.open() diff --git a/TeroStyle/Button.qml b/TeroStyle/Button.qml index d7e5a3b..08dec39 100644 --- a/TeroStyle/Button.qml +++ b/TeroStyle/Button.qml @@ -1,30 +1,50 @@ import QtQuick +import QtQuick.Layouts +import QtQuick.Controls.impl as I import QtQuick.Templates as T T.Button { id: control - implicitHeight: implicitContentHeight - implicitWidth: contentItem.width + + icon.color: Colors.foreground + icon.height: 21 + icon.width: 21 + implicitHeight: Math.max( + implicitBackgroundHeight + topInset + bottomInset, + implicitContentHeight + topPadding + bottomPadding + ) + implicitWidth: Math.max( + implicitBackgroundWidth + leftInset + rightInset, + implicitContentWidth + leftPadding + rightPadding + ) + padding: Dimensions.s - (icon.source.toString() === "" ? 0 : 1) background: Rectangle { + anchors.fill: parent color: Colors.primary radius: Dimensions.radius } - contentItem: Text { - color: Colors.foreground - font: control.font - padding: Dimensions.s + 2 + contentItem: I.IconLabel { + spacing: Dimensions.s + mirrored: control.mirrored + display: control.display + icon: control.icon text: control.text - // Make sure the button is at least wide enough to be comfortably clickable - width: Math.max(implicitWidth, 120) - horizontalAlignment: Text.AlignHCenter + font: control.font + color: Colors.foreground + } + + onIconChanged: () => { + // console.log("ICON '" + JSON.stringify(icon.source) + "' " + (icon.source.toString() === "") + " "); } MouseArea { id: mouseArea + anchors.fill: parent cursorShape: Qt.PointingHandCursor - onPressed: (mouse) => mouse.accepted = false + + onPressed: mouse => mouse.accepted = false } } diff --git a/images/ArrowRightEndOnRectangle.svg b/images/ArrowRightEndOnRectangle.svg new file mode 100644 index 0000000..fb1bc75 --- /dev/null +++ b/images/ArrowRightEndOnRectangle.svg @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/images/Bars3.svg b/images/Bars3.svg new file mode 100644 index 0000000..efb84c1 --- /dev/null +++ b/images/Bars3.svg @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/images/ChevronDown.svg b/images/ChevronDown.svg index 525053a..e63c2ff 100644 --- a/images/ChevronDown.svg +++ b/images/ChevronDown.svg @@ -1,3 +1,3 @@ -