diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-05-12 12:09:25 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-05-12 12:12:45 (GMT) |
commit | c711885b5694a51f0c22908e57e74c60188bd879 (patch) | |
tree | d88edb71d3ff7eb093ba661df74cb4ee82f44260 | |
parent | 6319d2d16c0c07f8919a748ed844f3db1e48e827 (diff) | |
download | Qt-c711885b5694a51f0c22908e57e74c60188bd879.zip Qt-c711885b5694a51f0c22908e57e74c60188bd879.tar.gz Qt-c711885b5694a51f0c22908e57e74c60188bd879.tar.bz2 |
The editor geometry in item views is not correctly updated when 1st
shown
The problem is that it gets the previous geometry of the cell whereas
its own sizeHint might lead to change the geometry of the cell.
Task-number: 253109
Reviewed-by: ogoffart
-rw-r--r-- | src/gui/itemviews/qabstractitemview.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qtreewidget/tst_qtreewidget.cpp | 20 |
2 files changed, 21 insertions, 1 deletions
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 4c1f7fc..90c38ca 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -2845,9 +2845,9 @@ void QAbstractItemView::setIndexWidget(const QModelIndex &index, QWidget *widget d->persistent.insert(widget); d->addEditor(index, widget, true); widget->show(); + dataChanged(index, index); // update the geometry if (!d->delayedPendingLayout) widget->setGeometry(visualRect(index)); - dataChanged(index, index); // update the geometry } } diff --git a/tests/auto/qtreewidget/tst_qtreewidget.cpp b/tests/auto/qtreewidget/tst_qtreewidget.cpp index c3595c2..906332c 100644 --- a/tests/auto/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/qtreewidget/tst_qtreewidget.cpp @@ -136,6 +136,7 @@ private slots: void rootItemFlags(); void task218661_setHeaderData(); void task245280_sortChildren(); + void task253109_itemHeight(); // QTreeWidgetItem void itemOperatorLessThan(); @@ -2879,6 +2880,25 @@ void tst_QTreeWidget::task245280_sortChildren() QCOMPARE(top.child(i)->text(1), QString::number(i)); } +void tst_QTreeWidget::task253109_itemHeight() +{ + QTreeWidget treeWidget; + treeWidget.setColumnCount(1); + treeWidget.show(); + QTest::qWait(200); + + QTreeWidgetItem item(&treeWidget); + class MyWidget : public QWidget + { + virtual QSize sizeHint() const { return QSize(200,100); } + } w; + treeWidget.setItemWidget(&item, 0, &w); + + QTest::qWait(200); + QCOMPARE(w.geometry(), treeWidget.visualItemRect(&item)); + +} + void tst_QTreeWidget::task206367_duplication() { QTreeWidget treeWidget; |