Enable grouping of macros

Based on OBS's source-tree model/view implementation
This commit is contained in:
WarmUpTill
2022-12-31 15:41:01 +01:00
committed by WarmUpTill
parent 2116bd7a78
commit a80af327d7
14 changed files with 1653 additions and 332 deletions

View File

@@ -17,7 +17,10 @@ MacroSelection::MacroSelection(QWidget *parent) : QComboBox(parent)
firstItem->setSelectable(false);
firstItem->setEnabled(false);
for (auto &m : switcher->macros) {
for (const auto &m : switcher->macros) {
if (m->IsGroup()) {
continue;
}
addItem(QString::fromStdString(m->Name()));
}
@@ -51,7 +54,12 @@ void MacroSelection::HideSelectedMacro()
if (!ssWindow) {
return;
}
int idx = ssWindow->ui->macros->currentRow();
const auto m = ssWindow->ui->macros->GetCurrentMacro();
if (!m) {
return;
}
int idx = findText(QString::fromStdString(m->Name()));
if (idx == -1) {
return;
}