PreferencesDialog::PreferencesDialog(QWidget* parent, Qt::WindowFlags f) : QDialog(parent, f) { ui.setupUi(this); connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonClicked(QAbstractButton*))); setUiFromPrefs(); rememberPrefs(); }
PreferencesDialog::PreferencesDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f) { ui.setupUi(this); connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *))); connect(ui.gflow, SIGNAL(valueChanged(int)), this, SLOT(gflowChanged(int))); connect(ui.gfhigh, SIGNAL(valueChanged(int)), this, SLOT(gfhighChanged(int))); loadSettings(); setUiFromPrefs(); rememberPrefs(); }
void PreferencesDialog::buttonClicked(QAbstractButton* button) { switch(ui->buttonBox->standardButton(button)) { case QDialogButtonBox::Discard: restorePrefs(); setUiFromPrefs(); syncSettings(); close(); break; case QDialogButtonBox::Apply: setPrefsFromUi(); syncSettings(); break; case QDialogButtonBox::FirstButton: setPrefsFromUi(); syncSettings(); close(); break; default: break; // ignore warnings. } }
void PreferencesDialog::showEvent(QShowEvent *event) { setUiFromPrefs(); rememberPrefs(); QDialog::showEvent(event); }
void PreferencesDialog::restorePrefs() { prefs = oldPrefs; setUiFromPrefs(); }