refactor: ActionDialog use proper ActionDialog::itemToggled in place of lambda
This commit is contained in:
parent
51e467d45e
commit
84c2234869
2 changed files with 7 additions and 3 deletions
|
|
@ -27,9 +27,7 @@ ActionDialog::ActionDialog(QWidget *parent, const ServerConfig &config, Hotkey &
|
||||||
connect(
|
connect(
|
||||||
ui->comboActionType, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &ActionDialog::actionTypeChanged
|
ui->comboActionType, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &ActionDialog::actionTypeChanged
|
||||||
);
|
);
|
||||||
connect(ui->listScreens, &QListWidget::itemChanged, this, [&] {
|
connect(ui->listScreens, &QListWidget::itemChanged, this, &ActionDialog::itemToggled);
|
||||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(canSave());
|
|
||||||
});
|
|
||||||
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &ActionDialog::accept);
|
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &ActionDialog::accept);
|
||||||
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &ActionDialog::reject);
|
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &ActionDialog::reject);
|
||||||
|
|
||||||
|
|
@ -117,6 +115,11 @@ void ActionDialog::keySequenceChanged()
|
||||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(canSave());
|
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(canSave());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ActionDialog::itemToggled() const
|
||||||
|
{
|
||||||
|
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(canSave());
|
||||||
|
}
|
||||||
|
|
||||||
void ActionDialog::actionTypeChanged(int index)
|
void ActionDialog::actionTypeChanged(int index)
|
||||||
{
|
{
|
||||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(canSave());
|
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(canSave());
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ protected Q_SLOTS:
|
||||||
private:
|
private:
|
||||||
void updateSize();
|
void updateSize();
|
||||||
void keySequenceChanged();
|
void keySequenceChanged();
|
||||||
|
void itemToggled() const;
|
||||||
void actionTypeChanged(int index);
|
void actionTypeChanged(int index);
|
||||||
bool isKeyAction(int index) const;
|
bool isKeyAction(int index) const;
|
||||||
bool canSave() const;
|
bool canSave() const;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue