changeset 512:ed65126e503d

* Use QDialogButtonBox in format dialog (surprised I missed that one all this time)
author Chris Cannam
date Thu, 26 Feb 2009 14:05:13 +0000
parents 455810e65543
children 1341e95eeae9
files widgets/CSVFormatDialog.cpp
diffstat 1 files changed, 8 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- 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 <QTableWidget>
 #include <QComboBox>
 #include <QLabel>
+#include <QDialogButtonBox>
 
 
 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());
 }