summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/global/qnamespace.qdoc3
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.cpp3
2 files changed, 6 insertions, 0 deletions
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index 0d9cacdb1f..b6ce9e03fd 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -2504,6 +2504,9 @@
to be explicitly set for instances of QListWidgetItem, QTableWidgetItem,
and QTreeWidgetItem.
+ Note that it is undefined behavior to reimplement QAbstractItemModel::hasChildren
+ to return true for an index if that index has the Qt::ItemNeverHasChildren flag set.
+
\sa QAbstractItemModel
*/
diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp
index 0d67c1f17b..f152dec5e6 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.cpp
+++ b/src/corelib/itemmodels/qabstractitemmodel.cpp
@@ -1679,6 +1679,9 @@ bool QAbstractItemModel::hasIndex(int row, int column, const QModelIndex &parent
Use rowCount() on the parent to find out the number of children.
+ Note that it is undefined behavior to report that a particular index hasChildren
+ with this method if the same index has the flag Qt::ItemNeverHasChildren set.
+
\sa parent(), index()
*/
bool QAbstractItemModel::hasChildren(const QModelIndex &parent) const