From b008753e1d67e2fc91a5ac12f49e28dbb1068d2d Mon Sep 17 00:00:00 2001 From: Tannin Date: Tue, 1 Sep 2015 19:49:28 +0200 Subject: workaround: after editing in a filtered view, if the edited item disappears as a result of the edit, no further editor could be opened --- src/modlistsortproxy.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/modlistsortproxy.cpp') diff --git a/src/modlistsortproxy.cpp b/src/modlistsortproxy.cpp index 39631b67..0eeaa86f 100644 --- a/src/modlistsortproxy.cpp +++ b/src/modlistsortproxy.cpp @@ -205,7 +205,7 @@ void ModListSortProxy::updateFilter(const QString &filter) bool ModListSortProxy::hasConflictFlag(const std::vector &flags) const { - foreach (ModInfo::EFlag flag, flags) { + for (ModInfo::EFlag flag : flags) { if ((flag == ModInfo::FLAG_CONFLICT_MIXED) || (flag == ModInfo::FLAG_CONFLICT_OVERWRITE) || (flag == ModInfo::FLAG_CONFLICT_OVERWRITTEN) || @@ -393,13 +393,20 @@ void ModListSortProxy::aboutToChangeData() { // having a filter active when dataChanged is called caused a crash // (at least with some Qt versions) + // this may be related to the fact that the item being edited may disappear from the view as a + // result of the edit m_PreChangeFilters = categoryFilter(); setCategoryFilter(std::vector()); } void ModListSortProxy::postDataChanged() { - setCategoryFilter(m_PreChangeFilters); - m_PreChangeFilters.clear(); + // if the filter is re-activated right away the editor can't be deleted but becomes invisible + // or at least the view continues to think it's being edited. As a result no new editor can be + // opened + QTimer::singleShot(10, [this] () { + setCategoryFilter(m_PreChangeFilters); + m_PreChangeFilters.clear(); + }); } -- cgit v1.3.1