summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtreeview
diff options
context:
space:
mode:
authorDavid Faure <faure@kde.org>2010-12-03 10:34:09 (GMT)
committerGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2011-09-29 09:33:26 (GMT)
commitd63910575949106f84dacf04abaa14fc866aa66b (patch)
tree57dbdb8ca4da4ef9c8782a0b93704bc53b376d44 /tests/auto/qtreeview
parent2c1e828af311bb103a6f02513cd339973e9582f6 (diff)
downloadQt-d63910575949106f84dacf04abaa14fc866aa66b.zip
Qt-d63910575949106f84dacf04abaa14fc866aa66b.tar.gz
Qt-d63910575949106f84dacf04abaa14fc866aa66b.tar.bz2
Set missing flags in the option when rendering QTreeView drag pixmap
QAbstractItemViewPrivate::renderToPixmap was not setting all the flags that the normal QTreeView painting sets: option.showDecorationSelected, option.viewItemPosition (so the drag pixmap looked wrong on Windows 7, with rects around each cell), and then the unittest also discovered that State_Children/State_Sibling wasn't set either. Task-number: QTBUG-15834 Merge-request: 2517 Reviewed-by: Gabriel
Diffstat (limited to 'tests/auto/qtreeview')
-rw-r--r--tests/auto/qtreeview/tst_qtreeview.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp
index facb982..c37a4ea 100644
--- a/tests/auto/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/qtreeview/tst_qtreeview.cpp
@@ -45,6 +45,7 @@
#include <QtTest/QtTest>
#include <QtGui/QtGui>
+#include <private/qabstractitemview_p.h>
#include "../../shared/util.h"
//TESTED_CLASS=
@@ -112,6 +113,8 @@ struct PublicView : public QTreeView
inline QStyleOptionViewItem viewOptions() const { return QTreeView::viewOptions(); }
inline int sizeHintForColumn(int column) const { return QTreeView::sizeHintForColumn(column); }
+ inline void startDrag(Qt::DropActions supportedActions) { QTreeView::startDrag(supportedActions); }
+ QAbstractItemViewPrivate* aiv_priv() { return static_cast<QAbstractItemViewPrivate*>(d_ptr.data()); }
};
class tst_QTreeView : public QObject
@@ -2947,7 +2950,7 @@ void tst_QTreeView::styleOptionViewItem()
bool allCollapsed;
};
- QTreeView view;
+ PublicView view;
QStandardItemModel model;
view.setModel(&model);
MyDelegate delegate;
@@ -3006,6 +3009,12 @@ void tst_QTreeView::styleOptionViewItem()
QApplication::processEvents();
QTRY_VERIFY(delegate.count >= 4);
+ // test that the rendering of drag pixmap sets the correct options too (QTBUG-15834)
+ delegate.count = 0;
+ QItemSelection sel(model.index(0,0), model.index(0,3));
+ QRect rect;
+ view.aiv_priv()->renderToPixmap(sel.indexes(), &rect);
+ QTRY_VERIFY(delegate.count >= 4);
//test dynamic models
{