Skip to content

Commit 3220809

Browse files
committed
Fix macro list displaying wrong contents after deleting group
This was only a visual issue - the correct macros were deleted in the backend
1 parent 72d5255 commit 3220809

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/macro-core/macro-tree.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -375,24 +375,24 @@ void MacroTreeModel::Add(std::shared_ptr<Macro> item)
375375

376376
void MacroTreeModel::Remove(std::shared_ptr<Macro> item)
377377
{
378-
auto startIdx = GetItemModelIndex(item);
379-
if (startIdx == -1) {
378+
auto uiStartIdx = GetItemModelIndex(item);
379+
if (uiStartIdx == -1) {
380380
return;
381381
}
382-
auto macroStartIdx = ModelIndexToMacroIndex(startIdx, _macros);
382+
auto macroStartIdx = ModelIndexToMacroIndex(uiStartIdx, _macros);
383383

384-
auto endIdx = startIdx;
384+
auto uiEndIdx = uiStartIdx;
385385
auto macroEndIdx = macroStartIdx;
386386

387387
bool isGroup = item->IsGroup();
388388
if (isGroup) {
389389
macroEndIdx += item->GroupSize();
390390
if (!item->IsCollapsed()) {
391-
endIdx = item->GroupSize();
391+
uiEndIdx += item->GroupSize();
392392
}
393393
}
394394

395-
beginRemoveRows(QModelIndex(), startIdx, endIdx);
395+
beginRemoveRows(QModelIndex(), uiStartIdx, uiEndIdx);
396396
_macros.erase(std::next(_macros.begin(), macroStartIdx),
397397
std::next(_macros.begin(), macroEndIdx + 1));
398398
endRemoveRows();

0 commit comments

Comments
 (0)