diff options
author | Stephen Kelly <steveire@gmail.com> | 2009-07-31 11:00:40 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-08-28 09:34:24 (GMT) |
commit | 4d197ec0eaeae61499d8ee6dc0e98147800f583e (patch) | |
tree | 606dd9392cc8e3bab799c38b118fc0f2c761a30f /src/corelib/kernel/qabstractitemmodel.h | |
parent | 7091ec8cd1ec94fb889230d69fc70d40a9f69b2d (diff) | |
download | Qt-4d197ec0eaeae61499d8ee6dc0e98147800f583e.zip Qt-4d197ec0eaeae61499d8ee6dc0e98147800f583e.tar.gz Qt-4d197ec0eaeae61499d8ee6dc0e98147800f583e.tar.bz2 |
Fix the API for resetting QAbstractItemModels.
This commit deprecates the QAIM::reset() method, and adds beginResetModel()
and endResetModel() methods, addressing Qt issue 247023.
http://www.qtsoftware.com/developer/task-tracker/index_html?method=entry&id=247023
If models and proxies use QAIM::reset() alone, then proxies will
emit modelAboutToBeReset after its source model is reset. This means that mapToSource
will not behave as expected (Will always return an invalid index) in a slot connected
to modelAboutToBeReset.
The usecase for this is maintaining viewstate (which items are selected, expanded)
when the model is reset. See BrowserWidget::modelChanged here:
http://websvn.kde.org/trunk/KDE/kdepim/akonadi/akonadiconsole/browserwidget.cpp?view=markup
Task-number: 247023
Reviewed-by: Olivier Goffart <ogoffart@trolltech.com>
Merge-request: 1072
Diffstat (limited to 'src/corelib/kernel/qabstractitemmodel.h')
-rw-r--r-- | src/corelib/kernel/qabstractitemmodel.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/corelib/kernel/qabstractitemmodel.h b/src/corelib/kernel/qabstractitemmodel.h index b47e4cb..1ca6cbe 100644 --- a/src/corelib/kernel/qabstractitemmodel.h +++ b/src/corelib/kernel/qabstractitemmodel.h @@ -293,6 +293,9 @@ protected: void reset(); + void beginResetModel(); + void endResetModel(); + void changePersistentIndex(const QModelIndex &from, const QModelIndex &to); void changePersistentIndexList(const QModelIndexList &from, const QModelIndexList &to); QModelIndexList persistentIndexList() const; |