diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-10-05 12:13:53 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-10-05 12:19:32 (GMT) |
commit | e1fbf1e016cbbf203964f3606ee2a34afe33bbd7 (patch) | |
tree | 130ac75637617930aca2193b8472fd0f46d05b66 | |
parent | 11e683d4a75d5071c490b8820a504de5eb47b971 (diff) | |
download | Qt-e1fbf1e016cbbf203964f3606ee2a34afe33bbd7.zip Qt-e1fbf1e016cbbf203964f3606ee2a34afe33bbd7.tar.gz Qt-e1fbf1e016cbbf203964f3606ee2a34afe33bbd7.tar.bz2 |
QAbstractItemView: Make sure the view is updated when a delegate is set.
The test tst_QListView::task254449_draggingItemToNegativeCoordinates was failing
in cocoa because of this. (on, cocoa, the call to show was doing the first paintEvent)
Reviewed-by: Thierry
-rw-r--r-- | src/gui/itemviews/qabstractitemview.cpp | 4 | ||||
-rw-r--r-- | tests/auto/qlistview/tst_qlistview.cpp | 7 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 18cab13..27528de 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -751,7 +751,6 @@ void QAbstractItemView::setItemDelegate(QAbstractItemDelegate *delegate) } } - if (delegate) { if (d->delegateRefCount(delegate) == 0) { connect(delegate, SIGNAL(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)), @@ -762,6 +761,7 @@ void QAbstractItemView::setItemDelegate(QAbstractItemDelegate *delegate) } } d->itemDelegate = delegate; + update(); } /*! @@ -826,6 +826,7 @@ void QAbstractItemView::setItemDelegateForRow(int row, QAbstractItemDelegate *de } d->rowDelegates.insert(row, delegate); } + update(); } /*! @@ -882,6 +883,7 @@ void QAbstractItemView::setItemDelegateForColumn(int column, QAbstractItemDelega } d->columnDelegates.insert(column, delegate); } + update(); } /*! diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp index d9cab02..cba1776 100644 --- a/tests/auto/qlistview/tst_qlistview.cpp +++ b/tests/auto/qlistview/tst_qlistview.cpp @@ -1617,6 +1617,8 @@ void tst_QListView::task254449_draggingItemToNegativeCoordinates() list.setModel(&model); list.setViewMode(QListView::IconMode); list.show(); + QTest::qWaitForWindowShown(&list); + class MyItemDelegate : public QStyledItemDelegate { public: @@ -1631,10 +1633,9 @@ void tst_QListView::task254449_draggingItemToNegativeCoordinates() mutable int numPaints; } delegate; list.setItemDelegate(&delegate); - delegate.numPaints = 0; - QTest::qWaitForWindowShown(&list); //makes sure the layout is done - QTRY_VERIFY(delegate.numPaints > 0); + QApplication::processEvents(); + QTRY_VERIFY(delegate.numPaints > 0); //makes sure the layout is done const QPoint topLeft(-6, 0); list.setPositionForIndex(topLeft, index); |