summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hartmann <thomas.hartmann@qt.io>2017-06-16 13:26:32 +0200
committerThomas Hartmann <thomas.hartmann@qt.io>2017-06-23 08:50:27 +0000
commit3944c73c512bf601d4b48552f313765cb3c722c8 (patch)
treed6d54be1cb93c18d65fd1ea269c2a99221806d80
parent2e128db77fade5ae6efa851e72551b5a5f82d64a (diff)
downloadqt-creator-3944c73c512bf601d4b48552f313765cb3c722c8.tar.gz
QmlDesigner: Fix combobox for font family
The editable combobox had some serious issues. I changed the signals we react to and the properties we use. We react on activated to change to fonts in the model. For some reason using currentText does not work reliable. We have to retrieve the current etxt manually using textAt(). We also react to accepted to changes in the text edit. Here we simply use editText. We also react to selection changes and change the font. Change-Id: I99abd7609f8b64ef446ce154aed0c2a61dfa00f9 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/FontComboBox.qml29
1 files changed, 26 insertions, 3 deletions
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/FontComboBox.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/FontComboBox.qml
index ffc774d7cd..6cca085da7 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/FontComboBox.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/FontComboBox.qml
@@ -58,12 +58,28 @@ Controls.ComboBox {
Layout.fillWidth: true
- onCurrentTextChanged: {
+ onAccepted: {
if (backendValue === undefined)
return;
- if (backendValue.value !== currentText)
- backendValue.value = currentText;
+ if (editText === "")
+ return
+
+ if (backendValue.value !== editText)
+ backendValue.value = editText;
+ }
+
+ onActivated: {
+ if (backendValue === undefined)
+ return;
+
+ if (editText === "")
+ return
+
+ var indexText = comboBox.textAt(index)
+
+ if (backendValue.value !== indexText)
+ backendValue.value = indexText;
}
ExtendedFunctionButton {
@@ -73,6 +89,13 @@ Controls.ComboBox {
visible: comboBox.enabled
}
+ Connections {
+ target: modelNodeBackend
+ onSelectionChanged: {
+ comboBox.editText = backendValue.value
+ }
+ }
+
Component.onCompleted: {
//Hack to style the text input
for (var i = 0; i < comboBox.children.length; i++) {