diff options
author | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2010-10-18 17:18:28 (GMT) |
---|---|---|
committer | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2010-10-19 08:33:27 (GMT) |
commit | 0916a68056154ecb60e4ea2c79726ab2e49b1532 (patch) | |
tree | a34f91a356b04a52610133b7c05e152893c91758 | |
parent | 6f1384fcbeea993d5be47590c696de60215b7608 (diff) | |
download | Qt-0916a68056154ecb60e4ea2c79726ab2e49b1532.zip Qt-0916a68056154ecb60e4ea2c79726ab2e49b1532.tar.gz Qt-0916a68056154ecb60e4ea2c79726ab2e49b1532.tar.bz2 |
Moving the resetInternalData slot to QAbstractProxyModel
Patch provided by Stephen Kelly <stephen.kelly@kdab.com>
Reviewed-by: gabi
Merge-request: 694
-rw-r--r-- | src/corelib/kernel/qabstractitemmodel.cpp | 22 | ||||
-rw-r--r-- | src/corelib/kernel/qabstractitemmodel.h | 3 | ||||
-rw-r--r-- | src/gui/itemviews/qabstractproxymodel.cpp | 24 | ||||
-rw-r--r-- | src/gui/itemviews/qabstractproxymodel.h | 3 |
4 files changed, 26 insertions, 26 deletions
diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp index 2affc91..4fc9792 100644 --- a/src/corelib/kernel/qabstractitemmodel.cpp +++ b/src/corelib/kernel/qabstractitemmodel.cpp @@ -1349,26 +1349,6 @@ 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 doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 10 - - \sa modelAboutToBeReset(), modelReset() -*/ -void QAbstractItemModel::resetInternalData() -{ - -} - - -/*! Constructs an abstract item model with the given \a parent. */ QAbstractItemModel::QAbstractItemModel(QObject *parent) @@ -2909,7 +2889,6 @@ void QAbstractItemModel::reset() Q_D(QAbstractItemModel); emit modelAboutToBeReset(); d->invalidatePersistentIndexes(); - QMetaObject::invokeMethod(this, "resetInternalData"); emit modelReset(); } @@ -2952,7 +2931,6 @@ void QAbstractItemModel::endResetModel() { Q_D(QAbstractItemModel); d->invalidatePersistentIndexes(); - QMetaObject::invokeMethod(this, "resetInternalData"); emit modelReset(); } diff --git a/src/corelib/kernel/qabstractitemmodel.h b/src/corelib/kernel/qabstractitemmodel.h index 18b43fe..63d9e6f 100644 --- a/src/corelib/kernel/qabstractitemmodel.h +++ b/src/corelib/kernel/qabstractitemmodel.h @@ -302,9 +302,6 @@ protected: void setRoleNames(const QHash<int,QByteArray> &roleNames); -protected slots: - void resetInternalData(); - private: Q_DECLARE_PRIVATE(QAbstractItemModel) Q_DISABLE_COPY(QAbstractItemModel) diff --git a/src/gui/itemviews/qabstractproxymodel.cpp b/src/gui/itemviews/qabstractproxymodel.cpp index 51dfa7a..12c4c7b 100644 --- a/src/gui/itemviews/qabstractproxymodel.cpp +++ b/src/gui/itemviews/qabstractproxymodel.cpp @@ -121,12 +121,15 @@ QAbstractProxyModel::~QAbstractProxyModel() void QAbstractProxyModel::setSourceModel(QAbstractItemModel *sourceModel) { Q_D(QAbstractProxyModel); - if (d->model) + if (d->model) { disconnect(d->model, SIGNAL(destroyed()), this, SLOT(_q_sourceModelDestroyed())); + disconnect(d->model, SIGNAL(modelReset()), this, SLOT(resetInternalData())); + } if (sourceModel) { d->model = sourceModel; connect(d->model, SIGNAL(destroyed()), this, SLOT(_q_sourceModelDestroyed())); + connect(d->model, SIGNAL(modelReset()), this, SLOT(resetInternalData())); } else { d->model = QAbstractItemModelPrivate::staticEmptyModel(); } @@ -380,6 +383,25 @@ Qt::DropActions QAbstractProxyModel::supportedDropActions() const return d->model->supportedDropActions(); } +/* + \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 doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 10 + + \sa modelAboutToBeReset(), modelReset() +*/ +void QAbstractProxyModel::resetInternalData() +{ + +} + QT_END_NAMESPACE #include "moc_qabstractproxymodel.cpp" diff --git a/src/gui/itemviews/qabstractproxymodel.h b/src/gui/itemviews/qabstractproxymodel.h index a5a1168..14eaa5a 100644 --- a/src/gui/itemviews/qabstractproxymodel.h +++ b/src/gui/itemviews/qabstractproxymodel.h @@ -95,6 +95,9 @@ public: QStringList mimeTypes() const; Qt::DropActions supportedDropActions() const; +protected slots: + void resetInternalData(); + protected: QAbstractProxyModel(QAbstractProxyModelPrivate &, QObject *parent); |