diff options
Diffstat (limited to 'src/corelib/itemmodels/qabstractitemmodel.cpp')
-rw-r--r-- | src/corelib/itemmodels/qabstractitemmodel.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp index 0f51147252..0d67c1f17b 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.cpp +++ b/src/corelib/itemmodels/qabstractitemmodel.cpp @@ -866,6 +866,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 @@ -3053,6 +3074,7 @@ void QAbstractItemModel::endResetModel() { Q_D(QAbstractItemModel); d->invalidatePersistentIndexes(); + QMetaObject::invokeMethod(this, "resetInternalData"); emit modelReset(QPrivateSignal()); } @@ -3270,6 +3292,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 @@ -3390,6 +3423,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. |