Add context menu option to expand / collapse all macro groups

This commit is contained in:
WarmUpTill
2025-07-06 20:57:01 +02:00
committed by WarmUpTill
parent 101ef4e973
commit 49c0de3f1b
4 changed files with 54 additions and 9 deletions

View File

@@ -1181,6 +1181,16 @@ bool MacroTree::SelectionEmpty() const
return selectedIndexes().empty();
}
bool MacroTree::GroupsExist() const
{
for (const auto &macro : GetMacros()) {
if (macro->IsGroup()) {
return true;
}
}
return false;
}
void MacroTree::ExpandGroup(std::shared_ptr<Macro> item) const
{
auto *mtm = GetModel();
@@ -1293,6 +1303,26 @@ void MacroTree::UngroupSelectedGroups()
assert(GetModel()->IsInValidState());
}
void MacroTree::ExpandAll()
{
for (const auto &macro : GetMacros()) {
if (!macro->IsGroup()) {
continue;
}
ExpandGroup(macro);
}
}
void MacroTree::CollapseAll()
{
for (const auto &macro : GetMacros()) {
if (!macro->IsGroup()) {
continue;
}
CollapseGroup(macro);
}
}
void MacroTree::SelectionChangedHelper(const QItemSelection &,
const QItemSelection &)
{