diff options
author | Stephen Kelly <stephen.kelly@kdab.com> | 2012-04-17 17:47:37 (GMT) |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-26 16:11:07 (GMT) |
commit | 96f0449f6e7b9c3f35fb7c546b6bbdb633d1a7bc (patch) | |
tree | 5d38d6ab7c59b334443414434e1897aad75a1a36 /tests/auto/qtreeview | |
parent | c507e783c931b74a3f200fa824fa9e9fee78ba9f (diff) | |
download | Qt-96f0449f6e7b9c3f35fb7c546b6bbdb633d1a7bc.zip Qt-96f0449f6e7b9c3f35fb7c546b6bbdb633d1a7bc.tar.gz Qt-96f0449f6e7b9c3f35fb7c546b6bbdb633d1a7bc.tar.bz2 |
Take account of spanned items in QTreeView when dragging.
Also remove some code which has been unused since it was introduced in
32182d107fa75e5619ecc91a81f50626f429ebe1
Task-number: QTBUG-25140
Change-Id: I27f9496c2c998de7ea858b943c2f19d979ef18c2
Reviewed-by: David Faure <faure@kde.org>
Diffstat (limited to 'tests/auto/qtreeview')
-rw-r--r-- | tests/auto/qtreeview/tst_qtreeview.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp index 05b2e3c..c0747a8 100644 --- a/tests/auto/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/qtreeview/tst_qtreeview.cpp @@ -216,6 +216,8 @@ private slots: void indexRowSizeHint(); void addRowsWhileSectionsAreHidden(); void filterProxyModelCrash(); + void renderToPixmap_data(); + void renderToPixmap(); void styleOptionViewItem(); void keyboardNavigationWithDisabled(); @@ -2901,6 +2903,37 @@ void tst_QTreeView::filterProxyModelCrash() view.repaint(); //used to crash } +void tst_QTreeView::renderToPixmap_data() +{ + QTest::addColumn<int>("row"); + QTest::newRow("row-0") << 0; + QTest::newRow("row-1") << 1; +} + +void tst_QTreeView::renderToPixmap() +{ + QFETCH(int, row); + PublicView view; + QStandardItemModel model; + + model.appendRow(new QStandardItem("Spanning")); + model.appendRow(QList<QStandardItem*>() << new QStandardItem("Not") << new QStandardItem("Spanning")); + + view.setModel(&model); + view.setFirstColumnSpanned(0, QModelIndex(), true); + +#ifdef QT_BUILD_INTERNAL + { + // We select the index at row=0 because it spans the + // column (regression test for an assert) + // We select the index at row=1 for coverage. + QItemSelection sel(model.index(row,0), model.index(row,1)); + QRect rect; + view.aiv_priv()->renderToPixmap(sel.indexes(), &rect); + } +#endif +} + void tst_QTreeView::styleOptionViewItem() { class MyDelegate : public QStyledItemDelegate |