From d510167e4a65b99acec15d3b1b25af7718c99e4e Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 23 Oct 2013 10:15:39 +0200 Subject: [PATCH] QmlDesigner.PropertyEditor: adding functionality to LineEdit * Adding the ExtendedFunctionButton * Adding blue highlight for modified values Change-Id: I44f7d3bfbf58f0fe60321b5c696d3e3ba9c6578f Reviewed-by: Thomas Hartmann --- .../HelperWidgets/LineEdit.qml | 48 ++++++++++++++++--- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/LineEdit.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/LineEdit.qml index 8e75dbf0b3f..5777afaede4 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/LineEdit.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/LineEdit.qml @@ -31,6 +31,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.1 as Controls import QtQuick.Controls.Styles 1.0 +import "Constants.js" as Constants Controls.TextField { @@ -40,17 +41,49 @@ Controls.TextField { property color highlightColor: "orange" property color textColor: "#eee" -// ExtendedFunctionButton { -// x: 2 -// y: 2 -// backendValue: checkBox.backendValue -// visible: spinBox.enabled -// } + ExtendedFunctionButton { + x: 2 + y: 4 + backendValue: lineEdit.backendValue + visible: lineEdit.enabled + } + + onBackendValueChanged: { + innerObject.evaluate(); + } QtObject { - property string valueFromBackend: lineEdit.backendValue.valueToString; + id: innerObject + + property string valueFromBackend: lineEdit.backendValue.value; + property bool baseStateFlag: isBaseState; + onValueFromBackendChanged: { lineEdit.text = valueFromBackend; + evaluate(); + } + + onBaseStateFlagChanged: { + evaluate(); + } + + function evaluate() { + print("evaluate") + if (lineEdit.backendValue === undefined) + return; + + if (baseStateFlag) { + if (lineEdit.backendValue.isInModel) + lineEdit.textColor = Constants.colorsChangedBaseText + else + lineEdit.textColor = Constants.colorsDefaultText + } else { + if (lineEdit.backendValue.isInSubState) + lineEdit.textColor = Constants.colorsChangedStateText + else + lineEdit.textColor = Constants.colorsDefaultText + } + } } @@ -74,6 +107,7 @@ Controls.TextField { textColor: lineEdit.textColor padding.top: 3 padding.bottom: 1 + padding.left: 16 background: Rectangle { implicitWidth: 100 implicitHeight: 23