Set "select <xyz>" to disabled and sort selection alphabetically

This commit is contained in:
WarmUpTill
2021-05-28 20:42:02 +02:00
committed by WarmUpTill
parent 546a83ee07
commit 5c4dd6dae1
4 changed files with 93 additions and 69 deletions

View File

@@ -1,9 +1,20 @@
#include "headers/macro-selection.hpp"
#include "headers/advanced-scene-switcher.hpp"
#include <QStandardItemModel>
MacroSelection::MacroSelection(QWidget *parent) : QComboBox(parent)
{
addItem(obs_module_text("AdvSceneSwitcher.selectMacro"));
QStandardItemModel *model =
qobject_cast<QStandardItemModel *>(this->model());
QModelIndex firstIndex =
model->index(0, modelColumn(), rootModelIndex());
QStandardItem *firstItem = model->itemFromIndex(firstIndex);
firstItem->setSelectable(false);
firstItem->setEnabled(false);
for (auto &m : switcher->macros) {
addItem(QString::fromStdString(m.Name()));
}