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>
This commit is contained in:
parent
97d564e920
commit
522b922d2a
@ -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),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user