From d8758b8c8b728ad9002ddc80486a5cadf4a757a1 Mon Sep 17 00:00:00 2001 From: Emeric Date: Thu, 21 Nov 2024 18:35:39 +0100 Subject: [PATCH] Minor improvements --- CMakeLists.txt | 2 +- qml/PageSelectors.qml | 6 +++--- src/main.cpp | 3 +-- thirdparty/ComponentLibrary/CMakeLists.txt | 2 +- .../ComponentLibrary/generic/SelectorMenuSunken.qml | 10 ++++++++-- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 76c67d0..899189d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,7 +99,7 @@ qt_add_translations(${CMAKE_PROJECT_NAME} ################################################################################ -# Qt librariries +# Qt libraries target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE Qt6::Core Qt6::Gui diff --git a/qml/PageSelectors.qml b/qml/PageSelectors.qml index 2703c11..0500050 100644 --- a/qml/PageSelectors.qml +++ b/qml/PageSelectors.qml @@ -48,7 +48,7 @@ Flickable { anchors.leftMargin: singleColumn ? 0 : Theme.componentMargin anchors.rightMargin: singleColumn ? 0 : Theme.componentMargin - text: qsTr("Selectors") + text: qsTr("SelectorMenu") source: "" } @@ -102,7 +102,7 @@ Flickable { anchors.leftMargin: singleColumn ? 0 : Theme.componentMargin anchors.rightMargin: singleColumn ? 0 : Theme.componentMargin - text: qsTr("Selectors") + text: qsTr("SelectorMenuSunken") source: "" } @@ -154,7 +154,7 @@ Flickable { anchors.leftMargin: singleColumn ? 0 : Theme.componentMargin anchors.rightMargin: singleColumn ? 0 : Theme.componentMargin - text: qsTr("Selectors") + text: qsTr("SelectorMenuColorful") source: "" } diff --git a/src/main.cpp b/src/main.cpp index a60808d..ee491d9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -90,11 +90,10 @@ int main(int argc, char *argv[]) // Then we start the UI QQmlApplicationEngine engine; - QQmlContext *engine_context = engine.rootContext(); - engine.addImportPath(":/qt/qml/QmlAppTemplate"); engine.addImportPath(":/qt/qml/ComponentLibrary"); + QQmlContext *engine_context = engine.rootContext(); engine_context->setContextProperty("settingsManager", sm); engine_context->setContextProperty("utilsApp", utilsApp); engine_context->setContextProperty("utilsLanguage", utilsLanguage); diff --git a/thirdparty/ComponentLibrary/CMakeLists.txt b/thirdparty/ComponentLibrary/CMakeLists.txt index a967742..5c8bf45 100644 --- a/thirdparty/ComponentLibrary/CMakeLists.txt +++ b/thirdparty/ComponentLibrary/CMakeLists.txt @@ -143,7 +143,7 @@ if (TARGET Qt::Location) maps/MapScale.qml ) else() - message(NOTICE "Skipping the mapping components from ComponentLibrairy as Qt6::Location is not used.") + message(NOTICE "Skipping the mapping components from ComponentLibrary as Qt6::Location is not used.") endif() list(APPEND MODULE_QML_FILES diff --git a/thirdparty/ComponentLibrary/generic/SelectorMenuSunken.qml b/thirdparty/ComponentLibrary/generic/SelectorMenuSunken.qml index 50cb813..d35841e 100644 --- a/thirdparty/ComponentLibrary/generic/SelectorMenuSunken.qml +++ b/thirdparty/ComponentLibrary/generic/SelectorMenuSunken.qml @@ -11,9 +11,15 @@ Item { opacity: enabled ? 1 : 0.66 + // colors + property color colorBackground: Theme.colorComponent + property color colorForeground: Theme.colorComponentBackground + + // states signal menuSelected(var index) property int currentSelection: 1 + // model property var model: null //////////////// @@ -21,7 +27,7 @@ Item { Rectangle { // background anchors.fill: parent radius: Theme.componentRadius - color: Theme.colorComponent + color: control.colorBackground } //////////////// @@ -37,7 +43,7 @@ Item { delegate: SelectorMenuItem { colorContent: Theme.colorComponentText colorContentHighlight: Theme.colorComponentText - colorBackgroundHighlight: Theme.colorComponentBackground + colorBackgroundHighlight: control.colorForeground height: parent.height highlighted: (control.currentSelection === idx) index: idx ?? 0