From 7b1f5cd3cce177f960ab8511a320ae21ad3bc8a024b9eb8f3f2c97bcacd4d673 Mon Sep 17 00:00:00 2001 From: Daniel Stoppek Date: Tue, 18 Mar 2025 08:50:39 +0100 Subject: [PATCH] Style code --- Gui/AddCustomer.qml | 1 - Gui/AddObject.qml | 1 - Gui/CustomerTable.qml | 3 ++- Gui/CustomersTable.qml | 2 +- Gui/EmployeeTable.qml | 1 + Gui/LoginScreen.qml | 2 +- Gui/ObjectTable.qml | 3 +-- Gui/ObjectsTable.qml | 4 +--- Gui/OfferTable.qml | 2 +- Gui/OffersTable.qml | 1 - Gui/SearchBar.qml | 1 - Gui/TopBar.qml | 2 +- TeroStyle/ComboBox.qml | 32 +++++++++++++++++++++----------- TeroStyle/Dimensions.qml | 5 +++-- TeroStyle/Field.qml | 8 +++++--- TeroStyle/TextField.qml | 11 +++++++---- TeroStyle/Typography.qml | 14 +++++++++----- 17 files changed, 54 insertions(+), 39 deletions(-) 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..3104523 100644 --- a/Gui/CustomerTable.qml +++ b/Gui/CustomerTable.qml @@ -2,7 +2,7 @@ import QtQuick import QtQuick.Layouts import QtQuick.Controls import Qt.labs.qmlmodels -import QtQuick.Controls.Fusion + Item { anchors.fill: parent @@ -14,6 +14,7 @@ Item { id: customersStack anchors.fill: parent initialItem: "CustomersTable.qml" + anchors.topMargin: Dimensions.m } } diff --git a/Gui/CustomersTable.qml b/Gui/CustomersTable.qml index c258084..08337f5 100644 --- a/Gui/CustomersTable.qml +++ b/Gui/CustomersTable.qml @@ -2,7 +2,7 @@ import QtQuick import QtQuick.Layouts import QtQuick.Controls import Qt.labs.qmlmodels -import QtQuick.Controls.Fusion + Item { diff --git a/Gui/EmployeeTable.qml b/Gui/EmployeeTable.qml index f10f85a..c01e6b5 100644 --- a/Gui/EmployeeTable.qml +++ b/Gui/EmployeeTable.qml @@ -11,6 +11,7 @@ Item id: employeesStack anchors.fill: parent initialItem: "EmployeesTable.qml" + anchors.topMargin: Dimensions.m } } diff --git a/Gui/LoginScreen.qml b/Gui/LoginScreen.qml index c3cc942..c1d4b8c 100644 --- a/Gui/LoginScreen.qml +++ b/Gui/LoginScreen.qml @@ -3,7 +3,7 @@ import QtQuick import QtQuick.Controls import QtQuick.Dialogs import QtQuick.Layouts -import TeroStyle + Item { property string recpass: "" diff --git a/Gui/ObjectTable.qml b/Gui/ObjectTable.qml index aee6002..e72e3a8 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: [""] @@ -12,7 +11,7 @@ Item { id: objectsStack anchors.fill: parent initialItem: "ObjectsTable.qml" - anchors.margins: 9 + anchors.topMargin: Dimensions.m } } diff --git a/Gui/ObjectsTable.qml b/Gui/ObjectsTable.qml index 71196e4..cdbb63c 100644 --- a/Gui/ObjectsTable.qml +++ b/Gui/ObjectsTable.qml @@ -2,14 +2,12 @@ import QtQuick import QtQuick.Layouts import QtQuick.Controls import Qt.labs.qmlmodels -import QtQuick.Controls.Fusion - Item { + SearchBar { id:searchBar - anchors.margins: 9 } Button diff --git a/Gui/OfferTable.qml b/Gui/OfferTable.qml index 7f16a20..f71625c 100644 --- a/Gui/OfferTable.qml +++ b/Gui/OfferTable.qml @@ -11,7 +11,7 @@ Item id: employeesStack anchors.fill: parent initialItem: "OffersTable.qml" - anchors.margins: 9 + anchors.topMargin: Dimensions.m } } diff --git a/Gui/OffersTable.qml b/Gui/OffersTable.qml index 8c64582..2b3c3fc 100644 --- a/Gui/OffersTable.qml +++ b/Gui/OffersTable.qml @@ -10,6 +10,5 @@ Item SearchBar { id:searchBar - anchors.margins: 9 } } diff --git a/Gui/SearchBar.qml b/Gui/SearchBar.qml index 83a942b..b62d9cb 100644 --- a/Gui/SearchBar.qml +++ b/Gui/SearchBar.qml @@ -7,7 +7,6 @@ RowLayout { id: searchBar - TextField { id: searchField diff --git a/Gui/TopBar.qml b/Gui/TopBar.qml index 3af0fae..8b4e6dc 100644 --- a/Gui/TopBar.qml +++ b/Gui/TopBar.qml @@ -6,7 +6,6 @@ RowLayout { id: topBar spacing: 0 - height: 35 width: parent.width anchors { @@ -23,6 +22,7 @@ RowLayout text: qsTr("Dashboard") implicitWidth: abrechnung.implicitContentWidth + 10 Layout.margins: 3 + Layout.leftMargin: 0 background: Rectangle { id: dashiBackie diff --git a/TeroStyle/ComboBox.qml b/TeroStyle/ComboBox.qml index b97e813..cc04628 100644 --- a/TeroStyle/ComboBox.qml +++ b/TeroStyle/ComboBox.qml @@ -2,14 +2,16 @@ import QtQuick import QtQuick.Templates as T import QtQuick.Controls -T.ComboBox { +T.ComboBox + { id: control font: Typography.body implicitHeight: background.height padding: Dimensions.m - background: Rectangle { + background: Rectangle + { border.color: Colors.interactive border.width: 1 color: Colors.mantle @@ -17,12 +19,14 @@ T.ComboBox { radius: Dimensions.radius } - delegate: T.ItemDelegate { + delegate: T.ItemDelegate + { width: control.width height: implicitContentHeight + topPadding + bottomPadding padding: Dimensions.s leftPadding: control.leftPadding - contentItem: Label { + contentItem: Label + { text: control.textRole ? model[control.textRole] : modelData color: Colors.foreground elide: Text.ElideRight @@ -30,7 +34,8 @@ T.ComboBox { } highlighted: control.highlightedIndex === index } - indicator: Label { + indicator: Label + { x: control.width - width height: control.height width: contentWidth + Dimensions.s * 2 @@ -39,7 +44,8 @@ T.ComboBox { horizontalAlignment: Text.AlignHCenter padding: Dimensions.s - background: Rectangle { + background: Rectangle + { anchors.fill: parent color: Colors.primary topRightRadius: Dimensions.radius @@ -48,17 +54,20 @@ T.ComboBox { } } - popup: T.Popup { + popup: T.Popup + { y: control.height z: 2 width: control.width - contentItem: ListView { + contentItem: ListView + { clip: true implicitHeight: contentHeight model: control.popup.visible ? control.delegateModel : null currentIndex: control.highlightedIndex - highlight: Rectangle { + highlight: Rectangle + { color: Colors.primary opacity: Colors.highlightOpacity } @@ -66,10 +75,11 @@ T.ComboBox { ScrollIndicator.vertical: ScrollIndicator {} } - background: Rectangle { + background: Rectangle + { color: Colors.mantle border.color: Colors.interactive radius: Dimensions.radius } } -} \ No newline at end of file +} diff --git a/TeroStyle/Dimensions.qml b/TeroStyle/Dimensions.qml index 0b15c64..994dba0 100644 --- a/TeroStyle/Dimensions.qml +++ b/TeroStyle/Dimensions.qml @@ -2,7 +2,8 @@ pragma Singleton import QtQuick -QtObject { +QtObject +{ /** * Distance for objects that are tied to each other, * e.g. a field and its label. @@ -22,4 +23,4 @@ QtObject { readonly property int l: 30 readonly property int radius: 4 -} \ No newline at end of file +} diff --git a/TeroStyle/Field.qml b/TeroStyle/Field.qml index 4a3a3dd..e0696fb 100644 --- a/TeroStyle/Field.qml +++ b/TeroStyle/Field.qml @@ -2,12 +2,14 @@ import QtQuick import QtQuick.Controls import QtQuick.Layouts -ColumnLayout { +ColumnLayout +{ required property string label spacing: Dimensions.s - Label { + Label + { text: label font: Typography.body } -} \ No newline at end of file +} diff --git a/TeroStyle/TextField.qml b/TeroStyle/TextField.qml index b5f8da9..2c1bde4 100644 --- a/TeroStyle/TextField.qml +++ b/TeroStyle/TextField.qml @@ -1,9 +1,11 @@ import QtQuick import QtQuick.Templates as T -T.TextField { +T.TextField +{ id: control - background: Rectangle { + background: Rectangle + { id: background color: Colors.mantle radius: Dimensions.radius @@ -16,5 +18,6 @@ T.TextField { implicitHeight: background.height placeholderTextColor: Colors.interactive font: Typography.body - padding: Dimensions.m -} \ No newline at end of file + padding: Dimensions.s + +} diff --git a/TeroStyle/Typography.qml b/TeroStyle/Typography.qml index ec5e21f..e778ca9 100644 --- a/TeroStyle/Typography.qml +++ b/TeroStyle/Typography.qml @@ -3,12 +3,15 @@ pragma Singleton import QtCore import QtQuick -Item { - readonly property FontLoader robotoCondensed: FontLoader { +Item +{ + readonly property FontLoader robotoCondensed: FontLoader + { source: "qrc:/fonts/RobotoCondensed.otf" } - readonly property font body: ({ + readonly property font body: + ({ family: robotoCondensed.font, pointSize: 16, weight: Font.Medium, @@ -16,11 +19,12 @@ Item { kerning: true, }) - readonly property font h1: ({ + readonly property font h1: + ({ family: body.family, pointSize: 38, weight: body.weight, letterSpacing: body.letterSpacing, kerning: body.kerning, }) -} \ No newline at end of file +}