From ef7773e5664dd8278831ed4d7d24dd4fc1aaefd3 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Thu, 30 Jan 2020 17:37:09 +0100 Subject: [PATCH] Doc: QPersistentModelIndex cannot be stored in a QStandardItem As discussed in the bug report, making sure that the reference counts are correct in such scenarios adds substantial complexity to the code, only to support a bad use-case for which QStandardItemModel was not designed. Change-Id: I663b490ed3471875386add17e7eadb7d8df50489 Fixes: QTBUG-78142 Reviewed-by: Paul Wicking --- src/corelib/itemmodels/qabstractitemmodel.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp index 6e97c2fd39..5caddf6aea 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.cpp +++ b/src/corelib/itemmodels/qabstractitemmodel.cpp @@ -107,6 +107,9 @@ void QPersistentModelIndexData::destroy(QPersistentModelIndexData *data) It is good practice to check that persistent model indexes are valid before using them. + \note You cannot store a QStandardItemModel's QPersistentModelIndex + in one of the model's items. + \sa {Model/View Programming}, QModelIndex, QAbstractItemModel */