summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2010-02-24 15:55:15 (GMT)
committerGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2010-02-24 16:14:40 (GMT)
commit77670c3c0fdc3021356e212e94042a0b5a4f4f8c (patch)
tree2c8535746651ace0394073697b0cc08fb7f90cb6 /src/gui/itemviews
parentec646b00cb485e2fa0d47ec4d5ffaf9a0fcf9ca6 (diff)
downloadQt-77670c3c0fdc3021356e212e94042a0b5a4f4f8c.zip
Qt-77670c3c0fdc3021356e212e94042a0b5a4f4f8c.tar.gz
Qt-77670c3c0fdc3021356e212e94042a0b5a4f4f8c.tar.bz2
Expand indicator would not be displayed after removal of a collapsed item's child
While setting the hasChildren property of QTreeViewItem, "collapsed" and "not visible" were being mistaken. Auto-test included. Reviewed-by: Olivier Task-number: QTBUG-7443
Diffstat (limited to 'src/gui/itemviews')
-rw-r--r--src/gui/itemviews/qtreeview.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp
index 706d2a8..37168eb 100644
--- a/src/gui/itemviews/qtreeview.cpp
+++ b/src/gui/itemviews/qtreeview.cpp
@@ -3770,10 +3770,15 @@ void QTreeViewPrivate::rowsRemoved(const QModelIndex &parent,
if (previousSibiling != -1 && after && model->rowCount(parent) == start)
viewItems[previousSibiling].hasMoreSiblings = false;
-
- updateChildCount(parentItem, -removedCount);
- if (parentItem != -1 && viewItems.at(parentItem).total == 0)
- viewItems[parentItem].hasChildren = false; //every children have been removed;
+ if (parentItem != -1) {
+ if (viewItems.at(parentItem).expanded) {
+ updateChildCount(parentItem, -removedCount);
+ if (viewItems.at(parentItem).total == 0)
+ viewItems[parentItem].hasChildren = false; //every children have been removed;
+ } else if (viewItems[parentItem].hasChildren && !hasVisibleChildren(parent)) {
+ viewItems[parentItem].hasChildren = false;
+ }
+ }
if (after) {
q->updateGeometries();
viewport->update();