diff options
| author | Tannin <devnull@localhost> | 2015-06-10 21:22:54 +0200 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2015-06-10 21:22:54 +0200 |
| commit | d25a81071c078585f14176283b89e1a6b0ad5795 (patch) | |
| tree | 002ccfa83c9db52f15dc4c2e919b7d68836f8594 /src/modlistsortproxy.cpp | |
| parent | ef9a61886c090e184c042f884687f401e25b1faa (diff) | |
more generic solution to the problem fixed in changeset bb74f8eb639c, now also applied in another location
Diffstat (limited to 'src/modlistsortproxy.cpp')
| -rw-r--r-- | src/modlistsortproxy.cpp | 23 |
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();
+}
+
|
