diff --git a/libtaskmanager/tasksmodel.cpp b/libtaskmanager/tasksmodel.cpp --- a/libtaskmanager/tasksmodel.cpp +++ b/libtaskmanager/tasksmodel.cpp @@ -70,6 +70,7 @@ bool launchInPlace = false; bool launchersEverSet = false; bool launcherSortingDirty = false; + QSet dirtyLaunchers; QList sortedPreFilterRows; QVector sortRowInsertQueue; QHash activityTaskCounts; @@ -377,14 +378,30 @@ const QModelIndex &launcherIndex = launcherTasksModel->index(j, 0); if (appsMatch(sourceIndex, launcherIndex)) { - QMetaObject::invokeMethod(launcherTasksModel, "dataChanged", Qt::QueuedConnection, - Q_ARG(QModelIndex, launcherIndex), Q_ARG(QModelIndex, launcherIndex)); + dirtyLaunchers.insert(launcherIndex); } } } } ); + QObject::connect(filterProxyModel, &QAbstractItemModel::rowsRemoved, q, + [this](const QModelIndex &parent, int first, int last) { + Q_UNUSED(parent) + Q_UNUSED(first) + Q_UNUSED(last) + + if (launcherTasksModel && !dirtyLaunchers.isEmpty()) { + foreach(const QModelIndex &launcherIndex, dirtyLaunchers) { + QMetaObject::invokeMethod(launcherTasksModel, "dataChanged", + Q_ARG(QModelIndex, launcherIndex), Q_ARG(QModelIndex, launcherIndex)); + } + + dirtyLaunchers.clear(); + } + } + ); + // Update anyTaskDemandsAttention on source data changes. QObject::connect(groupingProxyModel, &QAbstractItemModel::dataChanged, q, [this](const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector &roles) {