summaryrefslogtreecommitdiff
path: root/src/modlistsortproxy.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modlistsortproxy.cpp')
-rw-r--r--src/modlistsortproxy.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/modlistsortproxy.cpp b/src/modlistsortproxy.cpp
index b40b4144..f646a079 100644
--- a/src/modlistsortproxy.cpp
+++ b/src/modlistsortproxy.cpp
@@ -376,3 +376,26 @@ bool ModListSortProxy::dropMimeData(const QMimeData *data, Qt::DropAction action
return this->sourceModel()->dropMimeData(data, action, sourceIndex.row(), sourceIndex.column(),
sourceIndex.parent());
}
+
+void ModListSortProxy::setSourceModel(QAbstractItemModel *sourceModel)
+{
+ QSortFilterProxyModel::setSourceModel(sourceModel);
+
+ connect(sourceModel, SIGNAL(aboutToChangeData()), this, SLOT(aboutToChangeData()));
+ connect(sourceModel, SIGNAL(postDataChanged()), this, SLOT(postDataChanged()));
+}
+
+void ModListSortProxy::aboutToChangeData()
+{
+ // having a filter active when dataChanged is called caused a crash
+ // (at least with some Qt versions)
+ m_PreChangeFilters = categoryFilter();
+ setCategoryFilter(std::vector<int>());
+}
+
+void ModListSortProxy::postDataChanged()
+{
+ setCategoryFilter(m_PreChangeFilters);
+ m_PreChangeFilters.clear();
+}
+