mirror of https://github.com/qt/qtbase.git
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:
parent
ebde672032
commit
f4c8fb6b39
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue