diff options
author | Albert Astals Cid <albert.astals@canonical.com> | 2014-04-15 15:27:29 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-18 07:39:32 +0200 |
commit | 5772da7e911832e71634322345948b0c98d397bf (patch) | |
tree | 8526b8b4a782d3f1ff09b2aca783bd11d8bf1682 /src | |
parent | dc051f28b865e54d3834824ffea6f2562f0836c1 (diff) |
QQuickItemView/QQuickPathView: Fix creation of delegates
When the delegate is set before the model and
after the ItemView/PathView has been created
Task-number: QTBUG-38368
Change-Id: I6963abe28087699cf4e8921153dc7641bae3b220
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/quick/items/qquickitemview.cpp | 2 | ||||
-rw-r--r-- | src/quick/items/qquickpathview.cpp | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp index 46eec643fd..b4f6c34c6a 100644 --- a/src/quick/items/qquickitemview.cpp +++ b/src/quick/items/qquickitemview.cpp @@ -364,6 +364,8 @@ void QQuickItemView::setDelegate(QQmlComponent *delegate) if (!d->ownModel) { d->model = new QQmlDelegateModel(qmlContext(this)); d->ownModel = true; + if (isComponentComplete()) + static_cast<QQmlDelegateModel *>(d->model.data())->componentComplete(); } if (QQmlDelegateModel *dataModel = qobject_cast<QQmlDelegateModel*>(d->model)) { int oldCount = dataModel->count(); diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp index ec789670ab..45cd8e184c 100644 --- a/src/quick/items/qquickpathview.cpp +++ b/src/quick/items/qquickpathview.cpp @@ -1242,6 +1242,8 @@ void QQuickPathView::setDelegate(QQmlComponent *delegate) if (!d->ownModel) { d->model = new QQmlDelegateModel(qmlContext(this)); d->ownModel = true; + if (isComponentComplete()) + static_cast<QQmlDelegateModel *>(d->model.data())->componentComplete(); } if (QQmlDelegateModel *dataModel = qobject_cast<QQmlDelegateModel*>(d->model)) { int oldCount = dataModel->count(); |