summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorbjørn Martsum <tmartsum@gmail.com>2013-03-26 21:52:56 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-28 14:42:15 +0100
commitf4c8fb6b397744fde1581187b2c7cdb330e1e0f3 (patch)
tree93b62ad7740e65495470108f433c1f9df83e846f
parentebde672032383252fafe21f46b0b99279454af5b (diff)
downloadqtbase-f4c8fb6b397744fde1581187b2c7cdb330e1e0f3.tar.gz
QTreeView - improve ItemNeverHasChildren slightly
QTreeViewPrivate has a private function hasVisibleChildren that returns if an index has visual children. This can (and should) check the ItemNeverHasChildren flag. That will likely be an performance improvement and it will ensure consistent behavior in error-situations. (The flag will then always overrule even if the model is inconsistent) Change-Id: Ied37daf56c39daccea1cb4f5cc555d5cdbc7d971 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
-rw-r--r--src/widgets/itemviews/qtreeview.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index a15e050939..70523815e8 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -3739,6 +3739,8 @@ QPair<int,int> QTreeViewPrivate::startAndEndColumns(const QRect &rect) const
bool QTreeViewPrivate::hasVisibleChildren(const QModelIndex& parent) const
{
Q_Q(const QTreeView);
+ if (parent.flags() & Qt::ItemNeverHasChildren)
+ return false;
if (model->hasChildren(parent)) {
if (hiddenIndexes.isEmpty())
return true;