diff options
| author | Tannin <devnull@localhost> | 2015-09-01 19:49:28 +0200 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2015-09-01 19:49:28 +0200 |
| commit | b008753e1d67e2fc91a5ac12f49e28dbb1068d2d (patch) | |
| tree | 7f08348d94ce60b25cb917225ddcf22e44f0adc6 /src | |
| parent | 3c7ab3b668f0246b4cb966d225b407cfa08f9dfa (diff) | |
workaround: after editing in a filtered view, if the edited item disappears as
a result of the edit, no further editor could be opened
Diffstat (limited to 'src')
| -rw-r--r-- | src/modlistsortproxy.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
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<ModInfo::EFlag> &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<int>());
}
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();
+ });
}
|
