summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2010-03-23 14:34:38 (GMT)
committerGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2010-03-23 14:40:46 (GMT)
commit4a4458d1cf5ec7885c6f63f739b7ee80c70ad211 (patch)
treed0b621ac0c7356884945bdf0406c721ffd9e4bea /src/gui/itemviews
parentb17b2443bf8bd1880af593f379c93081ac6d7a80 (diff)
downloadQt-4a4458d1cf5ec7885c6f63f739b7ee80c70ad211.zip
Qt-4a4458d1cf5ec7885c6f63f739b7ee80c70ad211.tar.gz
Qt-4a4458d1cf5ec7885c6f63f739b7ee80c70ad211.tar.bz2
Wrong repaint when changing the default row height in QTreeView
When in QTreeView::dataChanged(), we didn't check for the actual change in the value before setting QTreeViewPrivate::defaultItemHeight. Hence, if uniformRowHeights is true, we completely miss any resizing of the items. Reviewed-by: Thierry Task-number: QTBUG-9216
Diffstat (limited to 'src/gui/itemviews')
-rw-r--r--src/gui/itemviews/qtreeview.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp
index 61ad79d..4636c50 100644
--- a/src/gui/itemviews/qtreeview.cpp
+++ b/src/gui/itemviews/qtreeview.cpp
@@ -674,15 +674,19 @@ void QTreeView::dataChanged(const QModelIndex &topLeft, const QModelIndex &botto
// refresh the height cache here; we don't really lose anything by getting the size hint,
// since QAbstractItemView::dataChanged() will get the visualRect for the items anyway
- int topViewIndex = d->viewIndex(topLeft);
- if (topViewIndex == 0)
- d->defaultItemHeight = indexRowSizeHint(topLeft);
bool sizeChanged = false;
+ int topViewIndex = d->viewIndex(topLeft);
+ if (topViewIndex == 0) {
+ int newDefaultItemHeight = indexRowSizeHint(topLeft);
+ sizeChanged = d->defaultItemHeight != newDefaultItemHeight;
+ d->defaultItemHeight = newDefaultItemHeight;
+ }
+
if (topViewIndex != -1) {
if (topLeft.row() == bottomRight.row()) {
int oldHeight = d->itemHeight(topViewIndex);
d->invalidateHeightCache(topViewIndex);
- sizeChanged = (oldHeight != d->itemHeight(topViewIndex));
+ sizeChanged |= (oldHeight != d->itemHeight(topViewIndex));
if (topLeft.column() == 0)
d->viewItems[topViewIndex].hasChildren = d->hasVisibleChildren(topLeft);
} else {