forked from qt-creator/qt-creator
QmlDesigner: Allow plain expressions to be set with LineEdit control
Task-number: QDS-2603 Change-Id: I10a1b513bc21b8736683d4ddc2e290c29b39696d Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -40,6 +40,7 @@ StudioControls.TextField {
|
||||
translationIndicatorVisible: showTranslateCheckBox
|
||||
|
||||
property bool writeValueManually: false
|
||||
property bool writeAsExpression: false
|
||||
|
||||
property bool __dirty: false
|
||||
|
||||
@@ -93,6 +94,9 @@ StudioControls.TextField {
|
||||
target: modelNodeBackend
|
||||
onSelectionToBeChanged: {
|
||||
if (__dirty && !writeValueManually) {
|
||||
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
|
||||
}
|
||||
|
Reference in New Issue
Block a user