diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2017-05-18 21:37:09 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2017-05-19 10:39:06 +0000 |
commit | 1eaebd0c3b7b21bb7483df9bbfe391823ecdc181 (patch) | |
tree | 9ba8e6bacc0209f282e40666f067fbae2de51ca3 /src/quicktemplates2/qquickcontrol_p_p.h | |
parent | f0a906cdfa7c02826592ed7f7faa1634686a331c (diff) |
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 <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquickcontrol_p_p.h')
-rw-r--r-- | src/quicktemplates2/qquickcontrol_p_p.h | 1 |
1 files changed, 1 insertions, 0 deletions
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; |