X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fselectionmodelsynchronizer.cpp;h=fe93c41b7b0fafa9bbf3984b3520b0d9308cf793;hp=4d2ed232ebc2bf6227da263a27a026e3eef7703b;hb=1a45f16a9734820fba42fe1db3f38dd1eee49df6;hpb=b65b9f7615165e8700a44d59b7275a55558dd45b diff --git a/src/client/selectionmodelsynchronizer.cpp b/src/client/selectionmodelsynchronizer.cpp index 4d2ed232..fe93c41b 100644 --- a/src/client/selectionmodelsynchronizer.cpp +++ b/src/client/selectionmodelsynchronizer.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2015 by the Quassel Project * + * Copyright (C) 2005-2018 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -96,7 +96,7 @@ void SelectionModelSynchronizer::selectionModelDestroyed(QObject *object) iter = _selectionModels.erase(iter); } else { - iter++; + ++iter; } } } @@ -252,9 +252,16 @@ void SelectionModelSynchronizer::currentChanged(const QModelIndex ¤t, cons QSet::iterator iter = _selectionModels.begin(); while (iter != _selectionModels.end()) { (*iter)->setCurrentIndex(mapFromSource(current, (*iter)), QItemSelectionModel::Current); - iter++; + ++iter; } _changeCurrentEnabled = true; + + // Trigger a dataChanged() signal from the base model to update all proxy models (e.g. filters). + // Since signals are protected, we have to use invokeMethod for faking signal emission. + if (previous.isValid()) { + QMetaObject::invokeMethod(model(), "dataChanged", Qt::DirectConnection, + Q_ARG(QModelIndex, previous), Q_ARG(QModelIndex, previous)); + } } @@ -267,7 +274,7 @@ void SelectionModelSynchronizer::selectionChanged(const QItemSelection &selected QSet::iterator iter = _selectionModels.begin(); while (iter != _selectionModels.end()) { (*iter)->select(mapSelectionFromSource(currentSelection(), (*iter)), QItemSelectionModel::ClearAndSelect); - iter++; + ++iter; } _changeSelectionEnabled = true; }