diff options
author | Jason McDonald <jason.mcdonald@nokia.com> | 2009-10-13 14:09:19 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2009-10-13 14:09:19 (GMT) |
commit | bc7732197cd65ceafded4e5b61f8c10edc0f6094 (patch) | |
tree | 2d970998cb37e09012911c785e26e5cb39f93166 | |
parent | b508fa2a8bf392da32c9209f36ecd27cc69a28b1 (diff) | |
parent | 0baa15e68c7b2e009c1f81f81148939725c216c8 (diff) | |
download | Qt-bc7732197cd65ceafded4e5b61f8c10edc0f6094.zip Qt-bc7732197cd65ceafded4e5b61f8c10edc0f6094.tar.gz Qt-bc7732197cd65ceafded4e5b61f8c10edc0f6094.tar.bz2 |
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt into 4.5
-rw-r--r-- | src/gui/itemviews/qabstractitemview.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qtreewidget/tst_qtreewidget.cpp | 39 |
2 files changed, 40 insertions, 1 deletions
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 6722e3a..a8c7f8b 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -2913,7 +2913,7 @@ void QAbstractItemView::update(const QModelIndex &index) //this test is important for peformance reason //For example in dataChanged we simply update all the cells without checking //it can be a major bottleneck to update rects that aren't even part of the viewport - if (d->viewport->geometry().intersects(rect)) + if (d->viewport->rect().intersects(rect)) d->viewport->update(rect); } } diff --git a/tests/auto/qtreewidget/tst_qtreewidget.cpp b/tests/auto/qtreewidget/tst_qtreewidget.cpp index d4fd1e3..3fcbdd6 100644 --- a/tests/auto/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/qtreewidget/tst_qtreewidget.cpp @@ -49,6 +49,9 @@ #include <qheaderview.h> #include <qlineedit.h> #include <QScrollBar> +#include <QStyledItemDelegate> + +#include "../../shared/util.h" //TESTED_CLASS= @@ -160,6 +163,7 @@ private slots: void task217309(); void setCurrentItemExpandsParent(); void task239150_editorWidth(); + void setTextUpdate(); public slots: void itemSelectionChanged(); @@ -3023,6 +3027,41 @@ void tst_QTreeWidget::task239150_editorWidth() +void tst_QTreeWidget::setTextUpdate() +{ + QTreeWidget treeWidget; + treeWidget.setColumnCount(2); + + class MyItemDelegate : public QStyledItemDelegate + { + public: + MyItemDelegate() : numPaints(0) { } + void paint(QPainter *painter, + const QStyleOptionViewItem &option, const QModelIndex &index) const + { + numPaints++; + QStyledItemDelegate::paint(painter, option, index); + } + + mutable int numPaints; + } delegate; + + treeWidget.setItemDelegate(&delegate); + treeWidget.show(); + QStringList strList; + strList << "variable1" << "0"; + QTreeWidgetItem *item = new QTreeWidgetItem(strList); + treeWidget.insertTopLevelItem(0, item); + QTest::qWait(50); + QTRY_VERIFY(delegate.numPaints > 0); + delegate.numPaints = 0; + + item->setText(1, "42"); + QApplication::processEvents(); + QTRY_VERIFY(delegate.numPaints > 0); +} + + QTEST_MAIN(tst_QTreeWidget) #include "tst_qtreewidget.moc" |