summaryrefslogtreecommitdiffstats
path: root/src/corelib/itemmodels/qabstractitemmodel.cpp
diff options
context:
space:
mode:
authorStephen Kelly <stephen.kelly@kdab.com>2012-11-23 15:24:48 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-01-29 09:28:43 +0100
commitd315e012184a2b71b7b5e41869d166c05093d13d (patch)
treeeef06bdd093861b8e0e394021ba398a0cf83294d /src/corelib/itemmodels/qabstractitemmodel.cpp
parentd78bd439dcb290e4318734693d418937b0bf8129 (diff)
Add the Qt::ItemNeverHasChildren flag and use it in QTreeView.
It can be used to determine whether expand() should really expand. Change-Id: If79d8c295a4ca1356e60051682b227524a065126 Reviewed-by: David Faure (KDE) <faure@kde.org> Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Diffstat (limited to 'src/corelib/itemmodels/qabstractitemmodel.cpp')
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp
index ebe38a97cd..ad9be5419b 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.cpp
+++ b/src/corelib/itemmodels/qabstractitemmodel.cpp
@@ -3272,6 +3272,17 @@ bool QAbstractTableModel::hasChildren(const QModelIndex &parent) const
}
/*!
+ \reimp
+ */
+Qt::ItemFlags QAbstractTableModel::flags(const QModelIndex &index) const
+{
+ Qt::ItemFlags f = QAbstractItemModel::flags(index);
+ if (index.isValid())
+ f |= Qt::ItemNeverHasChildren;
+ return f;
+}
+
+/*!
\class QAbstractListModel
\inmodule QtCore
\brief The QAbstractListModel class provides an abstract model that can be
@@ -3392,6 +3403,17 @@ QModelIndex QAbstractListModel::parent(const QModelIndex & /* index */) const
}
/*!
+ \reimp
+ */
+Qt::ItemFlags QAbstractListModel::flags(const QModelIndex &index) const
+{
+ Qt::ItemFlags f = QAbstractItemModel::flags(index);
+ if (index.isValid())
+ f |= Qt::ItemNeverHasChildren;
+ return f;
+}
+
+/*!
\internal
Returns the number of columns in the list with the given \a parent.