# HG changeset patch # User Chris Cannam # Date 1235657113 0 # Node ID ed65126e503dfff94356a635ac765f3567d3eb3c # Parent 455810e65543dd9b96c626f0f9b3b47e29ea978e * Use QDialogButtonBox in format dialog (surprised I missed that one all this time) diff -r 455810e65543 -r ed65126e503d widgets/CSVFormatDialog.cpp --- a/widgets/CSVFormatDialog.cpp Thu Feb 26 11:02:05 2009 +0000 +++ b/widgets/CSVFormatDialog.cpp Thu Feb 26 14:05:13 2009 +0000 @@ -23,6 +23,7 @@ #include #include #include +#include CSVFormatDialog::CSVFormatDialog(QWidget *parent, CSVFormat format, @@ -122,26 +123,16 @@ layout->addWidget(m_exampleWidget, 6, 0, 1, 4); layout->setColumnStretch(3, 10); - layout->setRowStretch(4, 10); + layout->setRowStretch(6, 10); - QPushButton *ok = new QPushButton(tr("OK")); - connect(ok, SIGNAL(clicked()), this, SLOT(accept())); - ok->setDefault(true); + QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok | + QDialogButtonBox::Cancel); + layout->addWidget(bb, 7, 0, 1, 4); + connect(bb, SIGNAL(accepted()), this, SLOT(accept())); + connect(bb, SIGNAL(rejected()), this, SLOT(reject())); - QPushButton *cancel = new QPushButton(tr("Cancel")); - connect(cancel, SIGNAL(clicked()), this, SLOT(reject())); + setLayout(layout); - QHBoxLayout *buttonLayout = new QHBoxLayout; - buttonLayout->addStretch(1); - buttonLayout->addWidget(ok); - buttonLayout->addWidget(cancel); - - QVBoxLayout *mainLayout = new QVBoxLayout; - mainLayout->addLayout(layout); - mainLayout->addLayout(buttonLayout); - - setLayout(mainLayout); - timingTypeChanged(m_timingTypeCombo->currentIndex()); }