forked from qt-creator/qt-creator
QmlDesigner: Fix ComboBox for raw strings
Change-Id: Ie35bda95290042f2faaf938ee67b6ee02e8c55b1 Reviewed-by: Henning Gründl <henning.gruendl@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -38,6 +38,10 @@ StudioControls.ComboBox {
|
||||
enum ValueType { String, Integer, Enum }
|
||||
property int valueType: ComboBox.ValueType.Enum
|
||||
|
||||
onModelChanged: colorLogic.invalidate()
|
||||
|
||||
// This is available in all editors.
|
||||
|
||||
onValueTypeChanged: {
|
||||
if (comboBox.valueType === ComboBox.ValueType.Integer)
|
||||
comboBox.useInteger = true
|
||||
@@ -98,8 +102,14 @@ StudioControls.ComboBox {
|
||||
} else {
|
||||
switch (comboBox.valueType) {
|
||||
case ComboBox.ValueType.String:
|
||||
if (comboBox.currentText !== comboBox.backendValue.value)
|
||||
comboBox.currentText = comboBox.backendValue.value
|
||||
if (comboBox.currentText !== comboBox.backendValue.value) {
|
||||
var index = comboBox.find(comboBox.backendValue.value)
|
||||
if (index < 0)
|
||||
index = 0
|
||||
|
||||
if (index !== comboBox.currentIndex)
|
||||
comboBox.currentIndex = index
|
||||
}
|
||||
break
|
||||
case ComboBox.ValueType.Integer:
|
||||
if (comboBox.currentIndex !== comboBox.backendValue.value)
|
||||
@@ -112,7 +122,7 @@ StudioControls.ComboBox {
|
||||
if (enumString === "")
|
||||
enumString = comboBox.backendValue.value
|
||||
|
||||
var index = comboBox.find(enumString)
|
||||
index = comboBox.find(enumString)
|
||||
|
||||
if (index < 0)
|
||||
index = 0
|
||||
|
Reference in New Issue
Block a user