From 1eaebd0c3b7b21bb7483df9bbfe391823ecdc181 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 18 May 2017 21:37:09 +0200 Subject: ScrollView: fix default Flickable content item creation Short version: do not emit contentItemChanged() while contentItem() is being called to avoid binding loops. Long version: ScrollView is a thin wrapper around Flickable, and when necessary, instantiates a Flickable behind the scenes. However, ScrollView cannot instantiate one unconditionally, because it has to work with existing Flickables, such as ListView and GridView, too. ScrollView { Item { } } // creates a Flickable ScrollView { Flickable { } } // does not create a Flickable ScrollView { contentItem: Flickable { } } // does not create a Flickable When a Flickable is created behind the scenes, it is assigned as the contentItem of the ScrollView. However, when the Flickable is created lazily as a result of ScrollView::contentItem being accessed, it must NOT emit contentItemChanged() while the contentItem() getter is being called, because that results to a binding loop. This problem was exposed by the recent attempts to enable QML caching at build time (QTBUG-58571). Change-Id: I712f2f30da454a6c22a722afe8a00ae240733571 Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquickcontrol_p_p.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/quicktemplates2/qquickcontrol_p_p.h') diff --git a/src/quicktemplates2/qquickcontrol_p_p.h b/src/quicktemplates2/qquickcontrol_p_p.h index 4dd6f32a..42924875 100644 --- a/src/quicktemplates2/qquickcontrol_p_p.h +++ b/src/quicktemplates2/qquickcontrol_p_p.h @@ -95,6 +95,7 @@ public: virtual void resizeContent(); virtual QQuickItem *getContentItem(); + void setContentItem_helper(QQuickItem *item, bool notify = true); #if QT_CONFIG(accessibility) void accessibilityActiveChanged(bool active) override; -- cgit v1.2.3