1
0
Fork 0

Launcher: fix QML warnings closing notifications

This commit is contained in:
James Turner 2021-04-01 17:36:34 +01:00
parent 5738d8cca9
commit df0f3e1b47

View file

@ -69,10 +69,19 @@ public:
return result; return result;
} }
void removeIndex(int index) void removeIndex(int row)
{ {
beginRemoveRows({}, index, index); // work aroud the role-by-role destruction order of model data
_data.erase(_data.begin() + index); // clear out the source first so the Loader unloads, before we
// null args. This avoids 'args is null' warnings from the loaded
// notification
_data[row].source.clear();
const auto idx = index(row, 0);
emit dataChanged(idx, idx, {SourceRole});
// now we can remove everything else
beginRemoveRows({}, row, row);
_data.erase(_data.begin() + row);
endRemoveRows(); endRemoveRows();
} }