diff options
author | Nils Jeisecke <jeisecke@saltation.de> | 2013-10-07 11:55:12 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-26 09:19:23 +0100 |
commit | 1061c7e5cfae88a336f1327cc20b2d8a0a3c6015 (patch) | |
tree | 058e8a07c1da7671ac8fcd9c91b91b386d106a2e /tests/auto/quick/qquickgridview/tst_qquickgridview.cpp | |
parent | 7d25db8ff452926e58b7a66608666b35c194fc69 (diff) |
Make GridView/ListView attached "view" property available to all delegate types
This is useful for accessing the view (e.g. "width", "cellWidth", ... properties)
from within section (ListView only), header, footer and highlight delegate components.
A typical usecase are components that are used in multiple views and therefore
cannot use the views's id for access.
The only attached property valid for those non-item delegates is "view". This
has been added to the documentation.
Change-Id: I33d976da778be23ed531a3b193ceee95ed9800d2
Task-number: QTBUG-32836
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Diffstat (limited to 'tests/auto/quick/qquickgridview/tst_qquickgridview.cpp')
-rw-r--r-- | tests/auto/quick/qquickgridview/tst_qquickgridview.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp index 2ee98c6c61..f4eec18690 100644 --- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp +++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp @@ -136,6 +136,7 @@ private slots: void onAdd_data(); void onRemove(); void onRemove_data(); + void attachedProperties_QTBUG_32836(); void columnCount(); void margins(); void creationContext(); @@ -4041,6 +4042,36 @@ void tst_QQuickGridView::onRemove_data() QTest::newRow("ten items, remove 4-10") << 10 << 4 << 6; } +void tst_QQuickGridView::attachedProperties_QTBUG_32836() +{ + QQuickView *window = createView(); + + window->setSource(testFileUrl("attachedProperties.qml")); + window->show(); + qApp->processEvents(); + + QQuickGridView *gridview = qobject_cast<QQuickGridView*>(window->rootObject()); + QVERIFY(gridview != 0); + + QQuickItem *header = gridview->headerItem(); + QVERIFY(header); + QCOMPARE(header->width(), gridview->width()); + + QQuickItem *footer = gridview->footerItem(); + QVERIFY(footer); + QCOMPARE(footer->width(), gridview->width()); + + QQuickItem *highlight = gridview->highlightItem(); + QVERIFY(highlight); + QCOMPARE(highlight->width(), gridview->width()); + + QQuickItem *currentItem = gridview->currentItem(); + QVERIFY(currentItem); + QCOMPARE(currentItem->width(), gridview->width()); + + delete window; +} + void tst_QQuickGridView::columnCount() { QQuickView window; |