diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2018-01-16 15:22:40 +0100 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2018-01-17 14:22:18 +0000 |
commit | da7d894deb4cc36155ade5e6a1ebecc3262363f8 (patch) | |
tree | 9b8337edd90dbdf2e4601a025cd2c72161e15a44 /src/quicktemplates2/qquicktumbler_p_p.h | |
parent | d61567f3cfa100aeab865bd6b436de87970575f5 (diff) |
Make Tumbler compatible with deferred execution
Now that the contentItem is created at a different stage, we
have to shuffle some code around and add some null checks.
Task-number: QTBUG-50992
Change-Id: I34d3a9ea9cb9ab54008a1015b37b1666538c085e
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquicktumbler_p_p.h')
-rw-r--r-- | src/quicktemplates2/qquicktumbler_p_p.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquicktumbler_p_p.h b/src/quicktemplates2/qquicktumbler_p_p.h index 0dcae762..38b0f60d 100644 --- a/src/quicktemplates2/qquicktumbler_p_p.h +++ b/src/quicktemplates2/qquicktumbler_p_p.h @@ -64,6 +64,7 @@ public: ~QQuickTumblerPrivate(); enum ContentItemType { + NoContentItem, UnsupportedContentItemType, PathViewContentItem, ListViewContentItem @@ -109,6 +110,34 @@ public: void itemChildRemoved(QQuickItem *, QQuickItem *) override; }; +class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTumblerAttachedPrivate : public QObjectPrivate, public QQuickItemChangeListener +{ + Q_DECLARE_PUBLIC(QQuickTumblerAttached) + +public: + QQuickTumblerAttachedPrivate(); + + void init(QQuickItem *delegateItem); + + void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override; + void itemChildAdded(QQuickItem *, QQuickItem *) override; + void itemChildRemoved(QQuickItem *, QQuickItem *) override; + + void _q_calculateDisplacement(); + void emitIfDisplacementChanged(qreal oldDisplacement, qreal newDisplacement); + + void viewDataSetUp(); + + static QQuickTumblerAttachedPrivate *get(QQuickTumblerAttached *attached); + + // The Tumbler that contains the delegate. Required to calculated the displacement. + QPointer<QQuickTumbler> tumbler; + // The index of the delegate. Used to calculate the displacement. + int index; + // The displacement for our delegate. + qreal displacement; +}; + QT_END_NAMESPACE #endif // QQUICKTUMBLER_P_P_H |