From 7adc062cf9370cb81c6766020a82ab5dc1f9e849 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 14 Aug 2020 13:41:08 +0300 Subject: [PATCH] QmlDesigner: Allow plain expressions to be set with LineEdit control Task-number: QDS-2603 Change-Id: I10a1b513bc21b8736683d4ddc2e290c29b39696d Reviewed-by: Thomas Hartmann --- .../imports/HelperWidgets/LineEdit.qml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/LineEdit.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/LineEdit.qml index 4a544a0f6a9..423a1aa1097 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/LineEdit.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/LineEdit.qml @@ -40,6 +40,7 @@ StudioControls.TextField { translationIndicatorVisible: showTranslateCheckBox property bool writeValueManually: false + property bool writeAsExpression: false property bool __dirty: false @@ -93,7 +94,10 @@ StudioControls.TextField { target: modelNodeBackend onSelectionToBeChanged: { if (__dirty && !writeValueManually) { - lineEdit.backendValue.value = text + if (writeAsExpression) + lineEdit.backendValue.expression = text + else + lineEdit.backendValue.value = text } else if (__dirty) { commitData() } @@ -112,8 +116,12 @@ StudioControls.TextField { if (backendValue.isTranslated) { setTranslateExpression() } else { - if (lineEdit.backendValue.value !== text) - lineEdit.backendValue.value = text; + if (writeAsExpression) { + if (lineEdit.backendValue.expression !== text) + lineEdit.backendValue.expression = text + } else if (lineEdit.backendValue.value !== text) { + lineEdit.backendValue.value = text + } } __dirty = false }