From 91b491ffb9bb59f8efd6076b64e0e478c12cef71 Mon Sep 17 00:00:00 2001 From: Henning Gruendl Date: Thu, 19 Dec 2019 11:29:44 +0100 Subject: [PATCH] QmlDesigner: Add error mode to ColorLogic Task-number: QDS-1221 Change-Id: I95009dc3700f3e308280fadaea374e7ba6dfa08b Reviewed-by: Thomas Hartmann --- .../imports/HelperWidgets/ColorLogic.qml | 10 +++++++++- .../imports/HelperWidgets/ComboBox.qml | 4 +++- .../imports/StudioTheme/Values.qml | 2 ++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorLogic.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorLogic.qml index 9c200097794..a39d7fd7886 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorLogic.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorLogic.qml @@ -36,20 +36,28 @@ QtObject { property bool isInModel: backendValue.isInModel; property bool isInSubState: backendValue.isInSubState; property bool highlight: textColor === __changedTextColor + property bool errorState: false - property color __defaultTextColor: StudioTheme.Values.themeTextColor + readonly property color __defaultTextColor: StudioTheme.Values.themeTextColor readonly property color __changedTextColor: StudioTheme.Values.themeInteraction + readonly property color __errorTextColor: StudioTheme.Values.themeErrorColor onBackendValueChanged: evaluate() onValueFromBackendChanged: evaluate() onBaseStateFlagChanged: evaluate() onIsInModelChanged: evaluate() onIsInSubStateChanged: evaluate() + onErrorStateChanged: evaluate() function evaluate() { if (innerObject.backendValue === undefined) return + if (innerObject.errorState) { + innerObject.textColor = __errorTextColor + return + } + if (innerObject.baseStateFlag) { if (innerObject.backendValue.isInModel) innerObject.textColor = __changedTextColor diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ComboBox.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ComboBox.qml index 23327590569..eb6fc60476f 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ComboBox.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ComboBox.qml @@ -33,7 +33,7 @@ StudioControls.ComboBox { property variant backendValue - labelColor: edit ? StudioTheme.Values.themeTextColor : colorLogic.textColor + labelColor: edit && !colorLogic.errorState ? StudioTheme.Values.themeTextColor : colorLogic.textColor property string scope: "Qt" property bool useInteger: false @@ -48,6 +48,8 @@ StudioControls.ComboBox { property bool showExtendedFunctionButton: true + property alias colorLogic: colorLogic + ExtendedFunctionLogic { id: extFuncLogic backendValue: comboBox.backendValue diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/Values.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/Values.qml index 32136421a46..ff10e1e79f5 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/Values.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/Values.qml @@ -108,6 +108,8 @@ QtObject { property string themeSliderInactiveTrackFocus: "#606060" property string themeSliderHandleFocus: values.themeInteraction + property string themeErrorColor: "#df3a3a" + // NEW NEW NEW NEW NEW property string themeControlBackgroundDisabled: "#363636" property string themeControlOutlineDisabled: "#404040"