From 522b922d2a7664d1e83239b262ea687681d6a731 Mon Sep 17 00:00:00 2001 From: Jan Mulder Date: Wed, 27 Dec 2017 09:02:52 +0100 Subject: 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 --- qt-models/filtermodels.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'qt-models/filtermodels.cpp') 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), -- cgit v1.2.3-70-g09d2