From f5e97c50012e9ff55f3360fec8c0a72b3348a998 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Mon, 16 May 2016 18:15:14 +0200 Subject: [PATCH] Make SettingComboBox work (mostly) properly = --- resources/qml/Settings/SettingComboBox.qml | 27 +++++++++------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/resources/qml/Settings/SettingComboBox.qml b/resources/qml/Settings/SettingComboBox.qml index 0f332b2aee..c9f3cb727b 100644 --- a/resources/qml/Settings/SettingComboBox.qml +++ b/resources/qml/Settings/SettingComboBox.qml @@ -13,6 +13,8 @@ SettingItem contents: ComboBox { + id: control + model: definition.options textRole: "value"; @@ -83,32 +85,25 @@ SettingItem } } } -/* - onActivated: { - valueChanged(options.getItem(index).value); - } - onModelChanged: { - updateCurrentIndex(); - } + onActivated: provider.setPropertyValue("value", definition.options[index].key) + onModelChanged: updateCurrentIndex(); - Component.onCompleted: { - parent.parent.valueChanged.connect(updateCurrentIndex) + Connections + { + target: provider + onPropertiesChanged: control.updateCurrentIndex() } function updateCurrentIndex() { - if (!options) { - return; - } - - for(var i = 0; i < options.rowCount(); ++i) { - if(options.getItem(i).value == value) { + for(var i = 0; i < definition.options.length; ++i) { + if(definition.options[i].key == provider.properties.value) { currentIndex = i; return; } } currentIndex = -1; - }*/ + } } }