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
|
translationIndicatorVisible: showTranslateCheckBox
|
||||||
|
|
||||||
property bool writeValueManually: false
|
property bool writeValueManually: false
|
||||||
|
property bool writeAsExpression: false
|
||||||
|
|
||||||
property bool __dirty: false
|
property bool __dirty: false
|
||||||
|
|
||||||
@@ -93,7 +94,10 @@ StudioControls.TextField {
|
|||||||
target: modelNodeBackend
|
target: modelNodeBackend
|
||||||
onSelectionToBeChanged: {
|
onSelectionToBeChanged: {
|
||||||
if (__dirty && !writeValueManually) {
|
if (__dirty && !writeValueManually) {
|
||||||
lineEdit.backendValue.value = text
|
if (writeAsExpression)
|
||||||
|
lineEdit.backendValue.expression = text
|
||||||
|
else
|
||||||
|
lineEdit.backendValue.value = text
|
||||||
} else if (__dirty) {
|
} else if (__dirty) {
|
||||||
commitData()
|
commitData()
|
||||||
}
|
}
|
||||||
@@ -112,8 +116,12 @@ StudioControls.TextField {
|
|||||||
if (backendValue.isTranslated) {
|
if (backendValue.isTranslated) {
|
||||||
setTranslateExpression()
|
setTranslateExpression()
|
||||||
} else {
|
} else {
|
||||||
if (lineEdit.backendValue.value !== text)
|
if (writeAsExpression) {
|
||||||
lineEdit.backendValue.value = text;
|
if (lineEdit.backendValue.expression !== text)
|
||||||
|
lineEdit.backendValue.expression = text
|
||||||
|
} else if (lineEdit.backendValue.value !== text) {
|
||||||
|
lineEdit.backendValue.value = text
|
||||||
|
}
|
||||||
}
|
}
|
||||||
__dirty = false
|
__dirty = false
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user