mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-21 17:34:57 -05:00
Fix macro list displaying wrong contents after deleting group
This was only a visual issue - the correct macros were deleted in the backend
This commit is contained in:
parent
72d5255c9e
commit
3220809c04
|
|
@ -375,24 +375,24 @@ void MacroTreeModel::Add(std::shared_ptr<Macro> item)
|
|||
|
||||
void MacroTreeModel::Remove(std::shared_ptr<Macro> item)
|
||||
{
|
||||
auto startIdx = GetItemModelIndex(item);
|
||||
if (startIdx == -1) {
|
||||
auto uiStartIdx = GetItemModelIndex(item);
|
||||
if (uiStartIdx == -1) {
|
||||
return;
|
||||
}
|
||||
auto macroStartIdx = ModelIndexToMacroIndex(startIdx, _macros);
|
||||
auto macroStartIdx = ModelIndexToMacroIndex(uiStartIdx, _macros);
|
||||
|
||||
auto endIdx = startIdx;
|
||||
auto uiEndIdx = uiStartIdx;
|
||||
auto macroEndIdx = macroStartIdx;
|
||||
|
||||
bool isGroup = item->IsGroup();
|
||||
if (isGroup) {
|
||||
macroEndIdx += item->GroupSize();
|
||||
if (!item->IsCollapsed()) {
|
||||
endIdx = item->GroupSize();
|
||||
uiEndIdx += item->GroupSize();
|
||||
}
|
||||
}
|
||||
|
||||
beginRemoveRows(QModelIndex(), startIdx, endIdx);
|
||||
beginRemoveRows(QModelIndex(), uiStartIdx, uiEndIdx);
|
||||
_macros.erase(std::next(_macros.begin(), macroStartIdx),
|
||||
std::next(_macros.begin(), macroEndIdx + 1));
|
||||
endRemoveRows();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user