summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@digia.com>2013-11-26 14:59:10 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-26 15:21:38 +0100
commit6ab374f0fd530c841470f93c8befb92f1f646470 (patch)
tree4811ff4f1d8eb383cf7e0f08f4892bfbb61e4c51 /src
parentefc340f2504bf7faa3591e4b53af0000a963089e (diff)
downloadqtquickcontrols-6ab374f0fd530c841470f93c8befb92f1f646470.tar.gz
qtquickcontrols-6ab374f0fd530c841470f93c8befb92f1f646470.tar.bz2
qtquickcontrols-6ab374f0fd530c841470f93c8befb92f1f646470.zip
ComboBox: Call resolveTextValue() after any model change
Particularly if the nature of the model has changed (e.g., from null to array). Task-number: QTBUG-34936 Change-Id: If07690a8836dcd786ed7a32afda1e344d048d31f Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/controls/ComboBox.qml8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/controls/ComboBox.qml b/src/controls/ComboBox.qml
index db39f579..ad28efb5 100644
--- a/src/controls/ComboBox.qml
+++ b/src/controls/ComboBox.qml
@@ -432,7 +432,7 @@ Control {
property ExclusiveGroup eg: ExclusiveGroup { id: eg }
- property bool __modelIsArray: popupItems.model ? popupItems.model.constructor === Array : false
+ property bool modelIsArray: false
Instantiator {
id: popupItems
@@ -440,6 +440,7 @@ Control {
property bool updatingModel: false
onModelChanged: {
+ popup.modelIsArray = !!model ? model.constructor === Array : false
if (active) {
if (updatingModel && popup.__selectedIndex === 0) {
// We still want to update the currentText
@@ -449,12 +450,13 @@ Control {
popup.__selectedIndex = 0
}
}
+ popup.resolveTextValue(comboBox.textRole)
}
MenuItem {
text: popup.textRole === '' ?
modelData :
- ((popup.__modelIsArray ? modelData[popup.textRole] : model[popup.textRole]) || '')
+ ((popup.modelIsArray ? modelData[popup.textRole] : model[popup.textRole]) || '')
onTriggered: {
if (index !== currentIndex)
activated(index)
@@ -479,7 +481,7 @@ Control {
}
var get = model['get'];
- if (!get && popup.__modelIsArray) {
+ if (!get && popup.modelIsArray && !!model[0]) {
if (model[0].constructor !== String && model[0].constructor !== Number)
get = function(i) { return model[i]; }
}