From 8eae3a923a540f3dbfe9445a1d58c59f20294684 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 28 Jan 2013 19:17:21 +0100 Subject: Provide the resetInternalData slot to cleanly reset data in proxy subclasses. This was part of Qt 4.8, but Qt 5.0 was branched before that, so the commit was lost. Change-Id: I2a2ab3c75a0943ac734d588ebd74bc158dd6aaaf Reviewed-by: Nils Jeisecke Reviewed-by: Lars Knoll --- src/corelib/itemmodels/qabstractitemmodel.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/corelib/itemmodels/qabstractitemmodel.cpp') diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp index 2a2d376a26..90e9886c90 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.cpp +++ b/src/corelib/itemmodels/qabstractitemmodel.cpp @@ -865,6 +865,27 @@ void QAbstractItemModelPrivate::columnsRemoved(const QModelIndex &parent, } } +/*! + \since 4.8 + + This slot is called just after the internal data of a model is cleared + while it is being reset. + + This slot is provided the convenience of subclasses of concrete proxy + models, such as subclasses of QSortFilterProxyModel which maintain extra + data. + + \snippet code/src_corelib_kernel_qabstractitemmodel.cpp 12 + + \note Due to a mistake, this slot is missing in Qt 5.0. + + \sa modelAboutToBeReset(), modelReset() +*/ +void QAbstractItemModel::resetInternalData() +{ + +} + /*! \class QModelIndex \inmodule QtCore @@ -3055,6 +3076,7 @@ void QAbstractItemModel::endResetModel() { Q_D(QAbstractItemModel); d->invalidatePersistentIndexes(); + QMetaObject::invokeMethod(this, "resetInternalData"); emit modelReset(QPrivateSignal()); } -- cgit v1.2.3