diff widgets/RangeInputDialog.cpp @ 282:4edaff85875d

* Add mouse actions to key and mouse reference dialog * Use QDialogButtonBox in all dialogs, for proper button ordering across platforms (requires Qt 4.2) * Fix #1733610 program does not exit if preferences dialog visible on close
author Chris Cannam
date Thu, 05 Jul 2007 11:07:01 +0000
parents dd573e090eed
children
line wrap: on
line diff
--- a/widgets/RangeInputDialog.cpp	Wed Jul 04 17:22:12 2007 +0000
+++ b/widgets/RangeInputDialog.cpp	Thu Jul 05 11:07:01 2007 +0000
@@ -19,6 +19,7 @@
 #include <QGridLayout>
 #include <QLabel>
 #include <QHBoxLayout>
+#include <QDialogButtonBox>
 #include <QPushButton>
 
 RangeInputDialog::RangeInputDialog(QString title, QString message,
@@ -55,24 +56,11 @@
     connect(m_rangeEnd, SIGNAL(valueChanged(double)),
             this, SLOT(rangeEndChanged(double)));
 
-    QHBoxLayout *hbox = new QHBoxLayout;
-    grid->addLayout(hbox, 2, 0, 1, 5);
-
-    QPushButton *ok = new QPushButton(tr("OK"), this);
-    ok->setDefault(true);
-
-    QPushButton *cancel = new QPushButton(tr("Cancel"), this);
-
-    QSize bs = ok->sizeHint().expandedTo(cancel->sizeHint());
-    ok->setFixedSize(bs);
-    cancel->setFixedSize(bs);
-
-    hbox->addStretch();
-    hbox->addWidget(ok);
-    hbox->addWidget(cancel);
-
-    QObject::connect(ok, SIGNAL(clicked()), this, SLOT(accept()));
-    QObject::connect(cancel, SIGNAL(clicked()), this, SLOT(reject()));
+    QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok |
+                                                QDialogButtonBox::Cancel);
+    grid->addWidget(bb, 2, 0, 1, 5);
+    connect(bb, SIGNAL(accepted()), this, SLOT(accept()));
+    connect(bb, SIGNAL(rejected()), this, SLOT(reject()));
 }
 
 RangeInputDialog::~RangeInputDialog()