mirror of
https://github.com/KDE/latte-dock.git
synced 2025-01-11 13:18:13 +03:00
details:update buttons state on dataChanged
This commit is contained in:
parent
131ce454f2
commit
7695443a90
@ -41,6 +41,9 @@ DetailsDialog::DetailsDialog(SettingsDialog *parent, Controller::Layouts *contro
|
||||
//! we must create handlers after creating/adjusting the ui
|
||||
m_handler = new Handler::DetailsHandler(this);
|
||||
|
||||
connect(m_handler, &Handler::DetailsHandler::currentLayoutChanged, this, &DetailsDialog::updateApplyButtonsState);
|
||||
connect(m_handler, &Handler::DetailsHandler::dataChanged, this, &DetailsDialog::updateApplyButtonsState);
|
||||
|
||||
connect(m_ui->buttonBox->button(QDialogButtonBox::Ok), &QPushButton::clicked,
|
||||
this, &DetailsDialog::on_ok);
|
||||
|
||||
@ -49,6 +52,8 @@ DetailsDialog::DetailsDialog(SettingsDialog *parent, Controller::Layouts *contro
|
||||
|
||||
connect(m_ui->buttonBox->button(QDialogButtonBox::Reset), &QPushButton::clicked,
|
||||
this, &DetailsDialog::on_reset);
|
||||
|
||||
updateApplyButtonsState();
|
||||
}
|
||||
|
||||
DetailsDialog::~DetailsDialog()
|
||||
@ -70,6 +75,17 @@ Latte::Corona *DetailsDialog::corona() const
|
||||
return m_parentDlg->corona();
|
||||
}
|
||||
|
||||
void DetailsDialog::updateApplyButtonsState()
|
||||
{
|
||||
if (m_handler->dataAreChanged()) {
|
||||
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
|
||||
m_ui->buttonBox->button(QDialogButtonBox::Reset)->setEnabled(true);
|
||||
} else {
|
||||
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||
m_ui->buttonBox->button(QDialogButtonBox::Reset)->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void DetailsDialog::accept()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
@ -68,6 +68,8 @@ private slots:
|
||||
void on_cancel();
|
||||
void on_reset();
|
||||
|
||||
void updateApplyButtonsState();
|
||||
|
||||
private:
|
||||
SettingsDialog *m_parentDlg{nullptr};
|
||||
Ui::DetailsDialog *m_ui;
|
||||
|
Loading…
Reference in New Issue
Block a user