aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickitemview_p.h
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2012-02-09 17:59:44 +1000
committerQt by Nokia <qt-info@nokia.com>2012-02-16 08:30:27 +0100
commit2df9abf7047afbe20b19d156ac37b58d9b047575 (patch)
tree0d4e13362d12f978d8d0c7871e161fd2f0fddeaa /src/quick/items/qquickitemview_p.h
parent7127120b68ec08296b6e2980d1c9ae1a34e5f28d (diff)
Built-in transition support for ListView & GridView
ListView and GridView can now be assigned transitions to be run when: - Populating the view (when initially setting the model / resetting) - Adding items - Removing items - Moving items The ViewTransition attached object can be used from within a transition declaration to access various information about the items that are being transitioned. Task-number: QTBUG-21504 Change-Id: Ie5c75ea511c8b15acc3f06fccf19abe34d3677f9 Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'src/quick/items/qquickitemview_p.h')
-rw-r--r--src/quick/items/qquickitemview_p.h86
1 files changed, 84 insertions, 2 deletions
diff --git a/src/quick/items/qquickitemview_p.h b/src/quick/items/qquickitemview_p.h
index e43f7c6d70..0d3cd1c3ce 100644
--- a/src/quick/items/qquickitemview_p.h
+++ b/src/quick/items/qquickitemview_p.h
@@ -48,6 +48,8 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
+QT_MODULE(Declarative)
+
class QDeclarativeChangeSet;
class QQuickItemViewPrivate;
@@ -74,6 +76,14 @@ class Q_AUTOTEST_EXPORT QQuickItemView : public QQuickFlickable
Q_PROPERTY(QDeclarativeComponent *footer READ footer WRITE setFooter NOTIFY footerChanged)
Q_PROPERTY(QQuickItem *footerItem READ footerItem NOTIFY footerItemChanged)
+ Q_PROPERTY(QDeclarativeTransition *populate READ populateTransition WRITE setPopulateTransition NOTIFY populateTransitionChanged)
+ Q_PROPERTY(QDeclarativeTransition *add READ addTransition WRITE setAddTransition NOTIFY addTransitionChanged)
+ Q_PROPERTY(QDeclarativeTransition *addDisplaced READ addDisplacedTransition WRITE setAddDisplacedTransition NOTIFY addDisplacedTransitionChanged)
+ Q_PROPERTY(QDeclarativeTransition *move READ moveTransition WRITE setMoveTransition NOTIFY moveTransitionChanged)
+ Q_PROPERTY(QDeclarativeTransition *moveDisplaced READ moveDisplacedTransition WRITE setMoveDisplacedTransition NOTIFY moveDisplacedTransitionChanged)
+ Q_PROPERTY(QDeclarativeTransition *remove READ removeTransition WRITE setRemoveTransition NOTIFY removeTransitionChanged)
+ Q_PROPERTY(QDeclarativeTransition *removeDisplaced READ removeDisplacedTransition WRITE setRemoveDisplacedTransition NOTIFY removeDisplacedTransitionChanged)
+
Q_PROPERTY(QDeclarativeComponent *highlight READ highlight WRITE setHighlight NOTIFY highlightChanged)
Q_PROPERTY(QQuickItem *highlightItem READ highlightItem NOTIFY highlightItemChanged)
Q_PROPERTY(bool highlightFollowsCurrentItem READ highlightFollowsCurrentItem WRITE setHighlightFollowsCurrentItem NOTIFY highlightFollowsCurrentItemChanged)
@@ -120,6 +130,27 @@ public:
void setHeader(QDeclarativeComponent *);
QQuickItem *headerItem() const;
+ QDeclarativeTransition *populateTransition() const;
+ void setPopulateTransition(QDeclarativeTransition *transition);
+
+ QDeclarativeTransition *addTransition() const;
+ void setAddTransition(QDeclarativeTransition *transition);
+
+ QDeclarativeTransition *addDisplacedTransition() const;
+ void setAddDisplacedTransition(QDeclarativeTransition *transition);
+
+ QDeclarativeTransition *moveTransition() const;
+ void setMoveTransition(QDeclarativeTransition *transition);
+
+ QDeclarativeTransition *moveDisplacedTransition() const;
+ void setMoveDisplacedTransition(QDeclarativeTransition *transition);
+
+ QDeclarativeTransition *removeTransition() const;
+ void setRemoveTransition(QDeclarativeTransition *transition);
+
+ QDeclarativeTransition *removeDisplacedTransition() const;
+ void setRemoveDisplacedTransition(QDeclarativeTransition *transition);
+
QDeclarativeComponent *highlight() const;
void setHighlight(QDeclarativeComponent *);
@@ -173,6 +204,14 @@ signals:
void headerItemChanged();
void footerItemChanged();
+ void populateTransitionChanged();
+ void addTransitionChanged();
+ void addDisplacedTransitionChanged();
+ void moveTransitionChanged();
+ void moveDisplacedTransitionChanged();
+ void removeTransitionChanged();
+ void removeDisplacedTransitionChanged();
+
void highlightChanged();
void highlightItemChanged();
void highlightFollowsCurrentItemChanged();
@@ -200,8 +239,6 @@ protected slots:
void animStopped();
void trackedPositionChanged();
-
-
private:
Q_DECLARE_PRIVATE(QQuickItemView)
};
@@ -287,8 +324,53 @@ public:
QString m_nextSection;
};
+class QQuickViewTransitionAttached : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(int index READ index NOTIFY indexChanged)
+ Q_PROPERTY(QQuickItem* item READ item NOTIFY itemChanged)
+ Q_PROPERTY(QPointF destination READ destination NOTIFY destinationChanged)
+
+ Q_PROPERTY(QList<int> targetIndexes READ targetIndexes NOTIFY targetIndexesChanged)
+ Q_PROPERTY(QDeclarativeListProperty<QObject> targetItems READ targetItems NOTIFY targetItemsChanged)
+
+public:
+ QQuickViewTransitionAttached(QObject *parent);
+
+ int index() const { return m_index; }
+ QQuickItem *item() const { return m_item; }
+ QPointF destination() const { return m_destination; }
+
+ QList<int> targetIndexes() const { return m_targetIndexes; }
+ QDeclarativeListProperty<QObject> targetItems();
+
+ static QQuickViewTransitionAttached *qmlAttachedProperties(QObject *);
+
+signals:
+ void indexChanged();
+ void itemChanged();
+ void destinationChanged();
+
+ void targetIndexesChanged();
+ void targetItemsChanged();
+
+private:
+ friend class FxViewItemTransitionManager;
+ int m_index;
+ QQuickItem *m_item;
+ QPointF m_destination;
+
+ QList<int> m_targetIndexes;
+ QList<QObject *> m_targetItems;
+};
+
QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickViewTransitionAttached)
+QML_DECLARE_TYPEINFO(QQuickViewTransitionAttached, QML_HAS_ATTACHED_PROPERTIES)
+
QT_END_HEADER
#endif // QQUICKITEMVIEW_P_H