forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -58,12 +58,28 @@ Controls.ComboBox {
|
|||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
onCurrentTextChanged: {
|
onAccepted: {
|
||||||
if (backendValue === undefined)
|
if (backendValue === undefined)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (backendValue.value !== currentText)
|
if (editText === "")
|
||||||
backendValue.value = currentText;
|
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 {
|
ExtendedFunctionButton {
|
||||||
@@ -73,6 +89,13 @@ Controls.ComboBox {
|
|||||||
visible: comboBox.enabled
|
visible: comboBox.enabled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: modelNodeBackend
|
||||||
|
onSelectionChanged: {
|
||||||
|
comboBox.editText = backendValue.value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
//Hack to style the text input
|
//Hack to style the text input
|
||||||
for (var i = 0; i < comboBox.children.length; i++) {
|
for (var i = 0; i < comboBox.children.length; i++) {
|
||||||
|
Reference in New Issue
Block a user