diff widgets/ListInputDialog.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 e6d0b097d102
children d632a1e87018
line wrap: on
line diff
--- a/widgets/ListInputDialog.cpp	Wed Jul 04 17:22:12 2007 +0000
+++ b/widgets/ListInputDialog.cpp	Thu Jul 05 11:07:01 2007 +0000
@@ -21,6 +21,7 @@
 #include <QStringList>
 #include <QRadioButton>
 #include <QPushButton>
+#include <QDialogButtonBox>
 
 ListInputDialog::ListInputDialog(QWidget *parent, const QString &title,
 				 const QString &labelText, const QStringList &list,
@@ -49,25 +50,12 @@
     m_footnote = new QLabel;
     vbox->addWidget(m_footnote);
     m_footnote->hide();
-
-    QHBoxLayout *hbox = new QHBoxLayout;
-    vbox->addLayout(hbox, Qt::AlignRight);
-
-    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);
+    vbox->addWidget(bb);
+    connect(bb, SIGNAL(accepted()), this, SLOT(accept()));
+    connect(bb, SIGNAL(rejected()), this, SLOT(reject()));
 }
 
 ListInputDialog::~ListInputDialog()