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>
This commit is contained in:
Thorbjørn Martsum 2013-03-26 21:52:56 +01:00 committed by The Qt Project
parent ebde672032
commit f4c8fb6b39
1 changed files with 2 additions and 0 deletions

View File

@ -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;