Double click on list item in run and sequence action to edit

This commit is contained in:
WarmUpTill
2022-02-25 22:17:28 +01:00
committed by WarmUpTill
parent 4e5aae7e5f
commit ae13a68cae
5 changed files with 61 additions and 4 deletions

View File

@@ -102,6 +102,8 @@ MacroActionRunEdit::MacroActionRunEdit(
SLOT(RemoveArg()));
QWidget::connect(_argUp, SIGNAL(clicked()), this, SLOT(ArgUp()));
QWidget::connect(_argDown, SIGNAL(clicked()), this, SLOT(ArgDown()));
connect(_argList, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this,
SLOT(ArgItemClicked(QListWidgetItem *)));
auto *entryLayout = new QHBoxLayout;
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
@@ -235,6 +237,33 @@ void MacroActionRunEdit::ArgDown()
}
}
void MacroActionRunEdit::ArgItemClicked(QListWidgetItem *item)
{
if (_loading || !_entryData) {
return;
}
std::string name;
bool accepted = AdvSSNameDialog::AskForName(
this,
obs_module_text("AdvSceneSwitcher.action.run.addArgument"),
obs_module_text(
"AdvSceneSwitcher.action.run.addArgumentDescription"),
name, item->text(), 170, false);
if (!accepted || name.empty()) {
return;
}
auto arg = QString::fromStdString(name);
QVariant v = QVariant::fromValue(arg);
item->setText(arg);
item->setData(Qt::UserRole, arg);
int idx = _argList->currentRow();
std::lock_guard<std::mutex> lock(switcher->m);
_entryData->_args[idx] = arg;
}
void MacroActionRunEdit::SetArgListSize()
{
setHeightToContentHeight(_argList);