void SettingsDlg::setButtonStates() {
SettingsPage *sp = currentPage();
- ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(sp && sp->hasChanged());
ui.buttonBox->button(QDialogButtonBox::Apply)->setEnabled(sp && sp->hasChanged());
ui.buttonBox->button(QDialogButtonBox::Reset)->setEnabled(sp && sp->hasChanged());
ui.buttonBox->button(QDialogButtonBox::RestoreDefaults)->setEnabled(sp && sp->hasDefaults());
void SettingsDlg::buttonClicked(QAbstractButton *button) {
switch(ui.buttonBox->standardButton(button)) {
case QDialogButtonBox::Ok:
- if(applyChanges()) accept();
+ if(currentPage() && currentPage()->hasChanged()) {
+ if(applyChanges()) accept();
+ } else accept();
break;
case QDialogButtonBox::Apply:
applyChanges();