diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2019-10-22 17:00:49 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2019-10-29 10:03:45 +0200 |
commit | b4c54935fb2896444f244bfee3c53f8ff18306da (patch) | |
tree | cc1b9498095007ab25475b562c450897b8c2dc13 /src/quicktemplates2/qquickcontainer.cpp | |
parent | b395f94ec3032b11eed5708acf4e72244ea728c2 (diff) |
SplitView: fix issue where Repeater items were not created
SplitView's contentItem is lazily created whenever contentItem() is called.
When adding regular, standalone items, they will go through
QQuickContainer::addItem(), which eventually calls contentItem(). This case
works fine.
Repeaters, on the other hand, call setTransparentForPositioner(true), which
QQuickContainerPrivate::contentData_append() checks for, and instead of calling
addItem(), reparents the Repeater to effectiveContentItem() with this line:
item->setParentItem(effectiveContentItem(p->contentItem));
If this happens before the contentItem is created, then the Repeater has no
parentItem and won't generate any items. So, instead of using the contentItem
member directly, call contentItem() to create it if it doesn't exist.
Fixes: QTBUG-79302
Change-Id: I258f7420d2fea843ed045d569f80e92fe1f507d2
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquickcontainer.cpp')
-rw-r--r-- | src/quicktemplates2/qquickcontainer.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/quicktemplates2/qquickcontainer.cpp b/src/quicktemplates2/qquickcontainer.cpp index 47aaa1e2..5f38c5b9 100644 --- a/src/quicktemplates2/qquickcontainer.cpp +++ b/src/quicktemplates2/qquickcontainer.cpp @@ -383,7 +383,7 @@ void QQuickContainerPrivate::contentData_append(QQmlListProperty<QObject> *prop, QQuickItem *item = qobject_cast<QQuickItem *>(obj); if (item) { if (QQuickItemPrivate::get(item)->isTransparentForPositioner()) - item->setParentItem(effectiveContentItem(p->contentItem)); + item->setParentItem(effectiveContentItem(q->contentItem())); else if (p->contentModel->indexOf(item, nullptr) == -1) q->addItem(item); } else { |