diff options
author | Jan Mulder <jlmulder@xs4all.nl> | 2017-12-27 09:02:52 +0100 |
---|---|---|
committer | Jan Mulder <jlmulder@xs4all.nl> | 2017-12-28 17:30:13 +0100 |
commit | 522b922d2a7664d1e83239b262ea687681d6a731 (patch) | |
tree | 2c3cd6fce12c3d94fd5fb1e12d12eedc599d2534 | |
parent | 97d564e92041ffb1997b76d6db7f0be612f9a29b (diff) | |
download | subsurface-522b922d2a7664d1e83239b262ea687681d6a731.tar.gz |
filter: setStringList() at end of every change
This is mainly code maintenance. Instead of emitting explicit
dataChanged signals, we can make sure that setStringList()
is called after all model data manipulation is ready. Accoording
to the Qt docs: "The model will notify any attached views
that its underlying data has changed".
In itself, this does not solve the tripped assert mentioned in
commit 5962f00679fae5, but this calling at the end just feels
better.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
-rw-r--r-- | qt-models/filtermodels.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/qt-models/filtermodels.cpp b/qt-models/filtermodels.cpp index f84b5335c..793b707ec 100644 --- a/qt-models/filtermodels.cpp +++ b/qt-models/filtermodels.cpp @@ -349,12 +349,12 @@ void LocationFilterModel::changeName(const QString &oldName, const QString &newN return; int newIndex = list.indexOf(newName); list[oldIndex] = newName; - setStringList(list); // If there was already an entry with the new name, we are merging entries. // Thus, if the old entry was selected, also select the new entry. if (newIndex >= 0 && checkState[oldIndex]) checkState[newIndex] = true; + setStringList(list); } void LocationFilterModel::addName(const QString &newName) @@ -367,8 +367,8 @@ void LocationFilterModel::addName(const QString &newName) if (!anyChecked || newName.isEmpty() || list.indexOf(newName) >= 0) return; list.prepend(newName); - setStringList(list); checkState.insert(checkState.begin(), true); + setStringList(list); } MultiFilterSortModel::MultiFilterSortModel(QObject *parent) : QSortFilterProxyModel(parent), |