From bb6fb2bb9e329024f617369dc3ae9dde2963287b Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Mon, 7 Sep 2009 13:06:10 +1000 Subject: Use data as the default property of the views. --- examples/declarative/listview/listview.qml | 21 +++++++++------------ src/declarative/fx/qfxgridview.h | 2 +- src/declarative/fx/qfxlistview.h | 2 +- src/declarative/fx/qfxpathview.h | 2 +- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/examples/declarative/listview/listview.qml b/examples/declarative/listview/listview.qml index 0f197b4..1cca5ad 100644 --- a/examples/declarative/listview/listview.qml +++ b/examples/declarative/listview/listview.qml @@ -66,17 +66,14 @@ Rectangle { model: MyPetsModel; delegate: PetDelegate currentItemPositioning: "SnapAuto"; snapPosition: 125 currentIndex: List1.currentIndex - children: [ - // Position a static highlight rather than a normal highlight so that - // when the view is flicked, the highlight does not move. - // By positioning the highlight at the same position as the snapPosition - // the item under the highlight will always be the current item. - // Note that we specify the 'children' property. This is because - // the default property of a ListView is 'delegate'. - Rectangle { - y: 125; width: 200; height: 50 - color: "#FFFF88"; z: -1 - } - ] + + // Position a static highlight rather than a normal highlight so that + // when the view is flicked, the highlight does not move. + // By positioning the highlight at the same position as the snapPosition + // the item under the highlight will always be the current item. + Rectangle { + y: 125; width: 200; height: 50 + color: "#FFFF88"; z: -1 + } } } diff --git a/src/declarative/fx/qfxgridview.h b/src/declarative/fx/qfxgridview.h index 4f2146d..4ebd311 100644 --- a/src/declarative/fx/qfxgridview.h +++ b/src/declarative/fx/qfxgridview.h @@ -58,7 +58,6 @@ class Q_DECLARATIVE_EXPORT QFxGridView : public QFxFlickable Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QFxGridView) Q_PROPERTY(QVariant model READ model WRITE setModel) - Q_CLASSINFO("DefaultProperty", "delegate") Q_PROPERTY(QmlComponent *delegate READ delegate WRITE setDelegate) Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged) Q_PROPERTY(QFxItem *current READ currentItem NOTIFY currentIndexChanged) @@ -70,6 +69,7 @@ class Q_DECLARATIVE_EXPORT QFxGridView : public QFxFlickable Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer) Q_PROPERTY(int cellWidth READ cellWidth WRITE setCellWidth NOTIFY cellSizeChanged) Q_PROPERTY(int cellHeight READ cellHeight WRITE setCellHeight NOTIFY cellSizeChanged) + Q_CLASSINFO("DefaultProperty", "data") public: QFxGridView(QFxItem *parent=0); diff --git a/src/declarative/fx/qfxlistview.h b/src/declarative/fx/qfxlistview.h index dbab57b..42ce1a2 100644 --- a/src/declarative/fx/qfxlistview.h +++ b/src/declarative/fx/qfxlistview.h @@ -60,7 +60,6 @@ class Q_DECLARATIVE_EXPORT QFxListView : public QFxFlickable Q_ENUMS(CurrentItemPositioning) Q_PROPERTY(QVariant model READ model WRITE setModel) - Q_CLASSINFO("DefaultProperty", "delegate") Q_PROPERTY(QmlComponent *delegate READ delegate WRITE setDelegate) Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged) Q_PROPERTY(QFxItem *current READ currentItem NOTIFY currentIndexChanged) @@ -75,6 +74,7 @@ class Q_DECLARATIVE_EXPORT QFxListView : public QFxFlickable Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer) Q_PROPERTY(QString sectionExpression READ sectionExpression WRITE setSectionExpression NOTIFY sectionExpressionChanged) Q_PROPERTY(QString currentSection READ currentSection NOTIFY currentSectionChanged) + Q_CLASSINFO("DefaultProperty", "data") public: QFxListView(QFxItem *parent=0); diff --git a/src/declarative/fx/qfxpathview.h b/src/declarative/fx/qfxpathview.h index a0ef262..3ee352a 100644 --- a/src/declarative/fx/qfxpathview.h +++ b/src/declarative/fx/qfxpathview.h @@ -66,7 +66,7 @@ class Q_DECLARATIVE_EXPORT QFxPathView : public QFxItem Q_PROPERTY(int count READ count) Q_PROPERTY(QmlComponent *delegate READ delegate WRITE setDelegate) Q_PROPERTY(int pathItemCount READ pathItemCount WRITE setPathItemCount) - Q_CLASSINFO("DefaultProperty", "delegate") + public: QFxPathView(QFxItem *parent=0); virtual ~QFxPathView(); -- cgit v0.12