aboutsummaryrefslogtreecommitdiffstats
path: root/src/templates
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2016-03-23 10:44:08 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2016-03-23 13:23:51 +0000
commitc59c43bbc44026a508746b1de2505f6185bd0310 (patch)
tree7d2be9445206f8107382c1c692bd20c994a23a16 /src/templates
parent18624d2d4602e5ac6466ee815a9c34bbf6061de1 (diff)
ComboBox: fix usage in an asynchronous Loader
The following comment in QQmlDelegateModel::object() helped to find a solution ie. using createdItem() instead of initItem(): If asynchronous is true or the component is being loaded asynchronously due to an ancestor being loaded asynchronously, item() may return 0. In this case createdItem() will be emitted when the item is available. [...] Change-Id: If3bf8e60834534ca07c8db8f502f4f11969057e8 Task-number: QTBUG-51972 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'src/templates')
-rw-r--r--src/templates/qquickcombobox.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/templates/qquickcombobox.cpp b/src/templates/qquickcombobox.cpp
index e37b0f52..fb9f6d4d 100644
--- a/src/templates/qquickcombobox.cpp
+++ b/src/templates/qquickcombobox.cpp
@@ -165,7 +165,7 @@ public:
void itemClicked();
- void initItem(int index, QObject *object);
+ void createdItem(int index, QObject *object);
void countChanged();
void updateCurrentText();
void increase();
@@ -235,7 +235,7 @@ void QQuickComboBoxPrivate::itemClicked()
}
}
-void QQuickComboBoxPrivate::initItem(int index, QObject *object)
+void QQuickComboBoxPrivate::createdItem(int index, QObject *object)
{
QQuickAbstractButton *button = qobject_cast<QQuickAbstractButton *>(object);
if (button)
@@ -316,7 +316,7 @@ void QQuickComboBoxPrivate::createDelegateModel()
if (oldModel) {
disconnect(delegateModel, &QQmlInstanceModel::countChanged, this, &QQuickComboBoxPrivate::countChanged);
disconnect(delegateModel, &QQmlInstanceModel::modelUpdated, this, &QQuickComboBoxPrivate::updateCurrentText);
- disconnect(delegateModel, &QQmlInstanceModel::initItem, this, &QQuickComboBoxPrivate::initItem);
+ disconnect(delegateModel, &QQmlInstanceModel::createdItem, this, &QQuickComboBoxPrivate::createdItem);
}
ownModel = false;
@@ -336,7 +336,7 @@ void QQuickComboBoxPrivate::createDelegateModel()
if (delegateModel) {
connect(delegateModel, &QQmlInstanceModel::countChanged, this, &QQuickComboBoxPrivate::countChanged);
connect(delegateModel, &QQmlInstanceModel::modelUpdated, this, &QQuickComboBoxPrivate::updateCurrentText);
- connect(delegateModel, &QQmlInstanceModel::initItem, this, &QQuickComboBoxPrivate::initItem);
+ connect(delegateModel, &QQmlInstanceModel::createdItem, this, &QQuickComboBoxPrivate::createdItem);
}
emit q->delegateModelChanged();