diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-06-24 21:23:43 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-06-24 21:23:43 +0200 |
commit | 6665c2431bb572bb710073de5dc1b6270980101c (patch) | |
tree | 00e2802bb20981c0c64a8cd7a9ddce941e5c0788 /src/qt/optionsdialog.cpp | |
parent | daaee738fcdcb6b319b522ee40bc26a95c8a7ad3 (diff) |
use buttonbox for options dialog
Diffstat (limited to 'src/qt/optionsdialog.cpp')
-rw-r--r-- | src/qt/optionsdialog.cpp | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index 1b5b2fefeb..3697b9fe41 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -16,6 +16,7 @@ #include <QIntValidator> #include <QDoubleValidator> #include <QRegExpValidator> +#include <QDialogButtonBox> /* First (currently only) page of options */ class MainOptionsPage : public QWidget @@ -64,17 +65,10 @@ OptionsDialog::OptionsDialog(QWidget *parent): QVBoxLayout *layout = new QVBoxLayout(); layout->addLayout(main_layout); - QHBoxLayout *buttons = new QHBoxLayout(); - buttons->addStretch(1); - QPushButton *ok_button = new QPushButton(tr("OK")); - buttons->addWidget(ok_button); - QPushButton *cancel_button = new QPushButton(tr("Cancel")); - buttons->addWidget(cancel_button); - apply_button = new QPushButton(tr("Apply")); - apply_button->setEnabled(false); - buttons->addWidget(apply_button); - - layout->addLayout(buttons); + QDialogButtonBox *buttonbox = new QDialogButtonBox(); + buttonbox->setStandardButtons(QDialogButtonBox::Apply|QDialogButtonBox::Ok|QDialogButtonBox::Cancel); + apply_button = buttonbox->button(QDialogButtonBox::Apply); + layout->addWidget(buttonbox); setLayout(layout); setWindowTitle(tr("Options")); @@ -89,9 +83,9 @@ OptionsDialog::OptionsDialog(QWidget *parent): connect(mapper, SIGNAL(currentIndexChanged(int)), this, SLOT(disableApply())); /* Event bindings */ - connect(ok_button, SIGNAL(clicked()), this, SLOT(okClicked())); - connect(cancel_button, SIGNAL(clicked()), this, SLOT(cancelClicked())); - connect(apply_button, SIGNAL(clicked()), this, SLOT(applyClicked())); + connect(buttonbox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(okClicked())); + connect(buttonbox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(cancelClicked())); + connect(buttonbox->button(QDialogButtonBox::Apply), SIGNAL(clicked()), this, SLOT(applyClicked())); } void OptionsDialog::setModel(OptionsModel *model) |