diff options
author | Nils Jeisecke <jeisecke@saltation.de> | 2013-01-07 16:54:33 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-01-30 15:17:05 +0100 |
commit | ffea8e98f712a8e2158a2bb843a649e96eea991e (patch) | |
tree | 52634831ce5440e402ced6d983982a6b5cbaa95b /src/corelib/itemmodels | |
parent | 36f64ec6ac07b3d02838b75f80efc445fd923891 (diff) |
Update roleNames in QAbstractProxyModel if sourceModel resets.
If a sourceModel resets, it's roleNames might have changed. This
is most likely the case if sourceModel itself is also a proxy model
of which the sourceModel was changed.
Task-number: QTBUG-28982
Change-Id: I102788f2c9bf97b4002b350673f9219e32e7a052
Reviewed-by: Nils Jeisecke <jeisecke@saltation.de>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'src/corelib/itemmodels')
-rw-r--r-- | src/corelib/itemmodels/qabstractproxymodel.cpp | 9 | ||||
-rw-r--r-- | src/corelib/itemmodels/qabstractproxymodel.h | 3 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/corelib/itemmodels/qabstractproxymodel.cpp b/src/corelib/itemmodels/qabstractproxymodel.cpp index ed5d0e9a85..d5887a52d5 100644 --- a/src/corelib/itemmodels/qabstractproxymodel.cpp +++ b/src/corelib/itemmodels/qabstractproxymodel.cpp @@ -148,6 +148,15 @@ void QAbstractProxyModel::setSourceModel(QAbstractItemModel *sourceModel) } /*! + Clears the roleNames of this proxy model. +*/ +void QAbstractProxyModel::resetInternalData() +{ + Q_D(QAbstractProxyModel); + d->roleNames = d->model->roleNames(); +} + +/*! Returns the model that contains the data that is available through the proxy model. */ QAbstractItemModel *QAbstractProxyModel::sourceModel() const diff --git a/src/corelib/itemmodels/qabstractproxymodel.h b/src/corelib/itemmodels/qabstractproxymodel.h index a7c2b3383d..9b26d6cead 100644 --- a/src/corelib/itemmodels/qabstractproxymodel.h +++ b/src/corelib/itemmodels/qabstractproxymodel.h @@ -101,6 +101,9 @@ Q_SIGNALS: #endif ); +protected Q_SLOTS: + void resetInternalData(); + protected: QAbstractProxyModel(QAbstractProxyModelPrivate &, QObject *parent); |