diff options
author | Stephen Kelly <stephen.kelly@kdab.com> | 2012-09-19 14:59:25 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-09-24 18:01:07 +0200 |
commit | 05aa8c6c12509cce87d1a3811c5ea1dd83fa0898 (patch) | |
tree | 86e17e828a08bee5914f9d045e03f87fc39bb6a1 /tests | |
parent | 3e9f27929004b7a5f44f14068b521e0d90c7b9c2 (diff) |
Implement viewOptions() logic in QListViewPrivate.
The private method is called in several places in QListViewPrivate,
but before this patch, the implementation in QAbstractItemView was
called. This meant that the options were not set properly,
resulting, for example, in icons in icon mode being laid out in
list mode (on the left and small).
This is a regression resulting from
8eab9cbce2014ffc6186dd6b6fb73da85956ee86 and
3578e05b293c1cc53582109001b20f02c7a1eeb7. Other views are not
affected in a similar way.
Change-Id: I753cb99410e367266753eaf2fa43361b9212ab96
Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp index 22f1e2fe4e..d252d78624 100644 --- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp +++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp @@ -141,6 +141,7 @@ private slots: void spacing_data(); void spacing(); void testScrollToWithHidden(); + void testViewOptions(); }; // Testing get/set functions @@ -910,6 +911,10 @@ class PublicListView : public QListView void setPositionForIndex(const QPoint &pos, const QModelIndex &index) { QListView::setPositionForIndex(pos, index); } + + QStyleOptionViewItem viewOptions() const { + return QListView::viewOptions(); + } }; class TestDelegate : public QItemDelegate @@ -2308,5 +2313,17 @@ void tst_QListView::testScrollToWithHidden() QCOMPARE(expectedScrollBarValue, lv.verticalScrollBar()->value()); } + + +void tst_QListView::testViewOptions() +{ + PublicListView view; + QStyleOptionViewItem options = view.viewOptions(); + QCOMPARE(options.decorationPosition, QStyleOptionViewItem::Left); + view.setViewMode(QListView::IconMode); + options = view.viewOptions(); + QCOMPARE(options.decorationPosition, QStyleOptionViewItem::Top); +} + QTEST_MAIN(tst_QListView) #include "tst_qlistview.moc" |