QmlDesigner: Fix UrlChoser

We have to set currentIndex to -1 if the url is not in the model.

Task-number: QTCREATORBUG-16494
Change-Id: I031a4f99d83b35ea1c0b805194b6aa42338f6509
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
Thomas Hartmann
2016-06-28 15:57:02 +02:00
committed by Tim Jenssen
parent 2a104dcfe7
commit ba7016ab1e

View File

@@ -54,9 +54,20 @@ RowLayout {
property bool isComplete: false property bool isComplete: false
property string textValue: backendValue.value function setCurrentText(text) {
if (text === "")
return
var index = comboBox.find(textValue)
if (index === -1)
currentIndex = -1
editText = textValue
}
property string textValue: backendValue.valueToString
onTextValueChanged: { onTextValueChanged: {
comboBox.editText = textValue setCurrentText(textValue)
} }
Layout.fillWidth: true Layout.fillWidth: true
@@ -72,7 +83,7 @@ RowLayout {
if (!comboBox.isComplete) if (!comboBox.isComplete)
return; return;
editText = backendValue.valueToString setCurrentText(textValue)
} }
onCurrentTextChanged: { onCurrentTextChanged: {
@@ -95,7 +106,7 @@ RowLayout {
} }
} }
comboBox.isComplete = true comboBox.isComplete = true
editText = backendValue.valueToString setCurrentText(textValue)
} }
} }