From f820164b1ab4edf0421ac2b222b51b1e12e5430c Mon Sep 17 00:00:00 2001 From: Mahmoud Badri Date: Tue, 16 Mar 2021 00:08:36 +0200 Subject: [PATCH] QmlDesigner: Use a different color for unimported items section Fixes: QDS-3873 Change-Id: Ic713353d8fe5c1bfb4ff11f1224294ecde182fa7 Reviewed-by: Thomas Hartmann --- .../qmldesigner/itemLibraryQmlSources/ItemDelegate.qml | 3 +++ .../qtcreator/qmldesigner/itemLibraryQmlSources/ItemsView.qml | 4 ++++ .../imports/HelperWidgets/Section.qml | 1 + .../propertyEditorQmlSources/imports/StudioTheme/Values.qml | 2 ++ .../qmldesigner/components/itemlibrary/itemlibraryimport.h | 2 ++ 5 files changed, 12 insertions(+) diff --git a/share/qtcreator/qmldesigner/itemLibraryQmlSources/ItemDelegate.qml b/share/qtcreator/qmldesigner/itemLibraryQmlSources/ItemDelegate.qml index 6e0724d86bb..3f59deb8061 100644 --- a/share/qtcreator/qmldesigner/itemLibraryQmlSources/ItemDelegate.qml +++ b/share/qtcreator/qmldesigner/itemLibraryQmlSources/ItemDelegate.qml @@ -31,6 +31,9 @@ import StudioTheme 1.0 as StudioTheme Item { id: delegateRoot + + property alias textColor: text.color + signal showContextMenu() Rectangle { diff --git a/share/qtcreator/qmldesigner/itemLibraryQmlSources/ItemsView.qml b/share/qtcreator/qmldesigner/itemLibraryQmlSources/ItemsView.qml index 9f7c2b13b64..f4e69d31ae6 100644 --- a/share/qtcreator/qmldesigner/itemLibraryQmlSources/ItemsView.qml +++ b/share/qtcreator/qmldesigner/itemLibraryQmlSources/ItemsView.qml @@ -155,6 +155,8 @@ ScrollView { sectionHeight: 30 sectionFontSize: 15 showArrow: categoryModel.rowCount() > 0 + labelColor: importUnimported ? StudioTheme.Values.themeUnimportedModuleColor + : StudioTheme.Values.themeTextColor leftPadding: 0 rightPadding: 0 topPadding: 0 @@ -204,6 +206,8 @@ ScrollView { model: itemModel delegate: ItemDelegate { visible: itemVisible + textColor: importUnimported ? StudioTheme.Values.themeUnimportedModuleColor + : StudioTheme.Values.themeTextColor width: styleConstants.cellWidth + itemGrid.flexibleWidth height: styleConstants.cellHeight onShowContextMenu: { diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/Section.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/Section.qml index cdc5780f523..57d0d65a771 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/Section.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/Section.qml @@ -32,6 +32,7 @@ import StudioTheme 1.0 as StudioTheme Item { id: section property alias caption: label.text + property alias labelColor: label.color property alias sectionHeight: header.height property alias sectionBackgroundColor: header.color property alias sectionFontSize: label.font.pixelSize diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/Values.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/Values.qml index 0ea1e18746c..4fd5c23c6c8 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/Values.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/Values.qml @@ -198,6 +198,8 @@ QtObject { property string themeStateBackground: Theme.color(Theme.DSstateBackgroundColor) property string themeStatePreviewOutline: Theme.color(Theme.DSstatePreviewOutline) + property string themeUnimportedModuleColor: "#e33c2e" + // Taken out of Constants.js property string themeChangedStateText: Theme.color(Theme.DSchangedStateText) diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibraryimport.h b/src/plugins/qmldesigner/components/itemlibrary/itemlibraryimport.h index 982e47df70e..997ca65c714 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibraryimport.h +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibraryimport.h @@ -42,6 +42,7 @@ class ItemLibraryImport : public QObject Q_PROPERTY(bool importUsed READ importUsed NOTIFY importUsedChanged FINAL) Q_PROPERTY(bool importExpanded READ importExpanded WRITE setImportExpanded NOTIFY importExpandChanged FINAL) Q_PROPERTY(bool importRemovable READ importRemovable NOTIFY importRemovableChanged FINAL) + Q_PROPERTY(bool importUnimported READ importUnimported FINAL) Q_PROPERTY(QObject *categoryModel READ categoryModel NOTIFY categoryModelChanged FINAL) public: @@ -90,6 +91,7 @@ signals: private: void updateRemovable(); + bool importUnimported() const { return m_sectionType == SectionType::Unimported; } Import m_import; bool m_importExpanded = true;