refactor: ActionDialog use proper ActionDialog::itemToggled in place of lambda

This commit is contained in:
sithlord48
2025-07-24 20:16:58 -04:00
committed by Nick Bolton
parent 51e467d45e
commit 84c2234869
2 changed files with 7 additions and 3 deletions

View File

@ -27,9 +27,7 @@ ActionDialog::ActionDialog(QWidget *parent, const ServerConfig &config, Hotkey &
connect(
ui->comboActionType, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &ActionDialog::actionTypeChanged
);
connect(ui->listScreens, &QListWidget::itemChanged, this, [&] {
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(canSave());
});
connect(ui->listScreens, &QListWidget::itemChanged, this, &ActionDialog::itemToggled);
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &ActionDialog::accept);
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &ActionDialog::reject);
@ -117,6 +115,11 @@ void ActionDialog::keySequenceChanged()
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(canSave());
}
void ActionDialog::itemToggled() const
{
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(canSave());
}
void ActionDialog::actionTypeChanged(int index)
{
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(canSave());

View File

@ -44,6 +44,7 @@ protected Q_SLOTS:
private:
void updateSize();
void keySequenceChanged();
void itemToggled() const;
void actionTypeChanged(int index);
bool isKeyAction(int index) const;
bool canSave() const;