diff options
author | Henning Gruendl <henning.gruendl@qt.io> | 2021-09-20 12:13:03 +0200 |
---|---|---|
committer | Henning Gründl <henning.gruendl@qt.io> | 2021-09-21 17:06:42 +0000 |
commit | 4e1eb3727f31f3ee05f95dec8e799d752836e3d0 (patch) | |
tree | 9736cf75d9adb1560b35f3ea1864cbc6d257b14a /share | |
parent | f8f1732a1e149cc16f7b9336b75094d46ea6ab77 (diff) |
QmlDesigner: Cleanup color logic code
Change-Id: I33019c06bc9c1f077ac88367f3b8ea279e2801c5
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Diffstat (limited to 'share')
-rw-r--r-- | share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorLogic.qml | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorLogic.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorLogic.qml index 2f5a78bdbc..06ec4ff1ac 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorLogic.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorLogic.qml @@ -27,57 +27,57 @@ import QtQuick 2.15 import StudioTheme 1.0 as StudioTheme QtObject { - id: innerObject + id: root property variant backendValue property color textColor: StudioTheme.Values.themeTextColor - property variant valueFromBackend: backendValue === undefined ? 0 : backendValue.value + property variant valueFromBackend: root.backendValue === undefined ? 0 : root.backendValue.value property bool baseStateFlag: isBaseState property bool isInModel: { - if (backendValue !== undefined && backendValue.isInModel !== undefined) - return backendValue.isInModel + if (root.backendValue !== undefined && root.backendValue.isInModel !== undefined) + return root.backendValue.isInModel return false } property bool isInSubState: { - if (backendValue !== undefined && backendValue.isInSubState !== undefined) - return backendValue.isInSubState + if (root.backendValue !== undefined && root.backendValue.isInSubState !== undefined) + return root.backendValue.isInSubState return false } - property bool highlight: textColor === __changedTextColor + property bool highlight: root.textColor === root.__changedTextColor property bool errorState: false readonly property color __defaultTextColor: StudioTheme.Values.themeTextColor readonly property color __changedTextColor: StudioTheme.Values.themeInteraction readonly property color __errorTextColor: StudioTheme.Values.themeError - onBackendValueChanged: evaluate() - onValueFromBackendChanged: evaluate() - onBaseStateFlagChanged: evaluate() - onIsInModelChanged: evaluate() - onIsInSubStateChanged: evaluate() - onErrorStateChanged: evaluate() + onBackendValueChanged: root.evaluate() + onValueFromBackendChanged: root.evaluate() + onBaseStateFlagChanged: root.evaluate() + onIsInModelChanged: root.evaluate() + onIsInSubStateChanged: root.evaluate() + onErrorStateChanged: root.evaluate() function evaluate() { - if (innerObject.backendValue === undefined) + if (root.backendValue === undefined) return - if (innerObject.errorState) { - innerObject.textColor = __errorTextColor + if (root.errorState) { + root.textColor = root.__errorTextColor return } - if (innerObject.baseStateFlag) { - if (innerObject.backendValue.isInModel) - innerObject.textColor = __changedTextColor + if (root.baseStateFlag) { + if (root.backendValue.isInModel) + root.textColor = root.__changedTextColor else - innerObject.textColor = __defaultTextColor + root.textColor = root.__defaultTextColor } else { - if (innerObject.backendValue.isInSubState) - innerObject.textColor = StudioTheme.Values.themeChangedStateText + if (root.backendValue.isInSubState) + root.textColor = StudioTheme.Values.themeChangedStateText else - innerObject.textColor = __defaultTextColor + root.textColor = root.__defaultTextColor } } } |