diff widgets/ItemEditDialog.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 0f36cdf407a6
children b6397738444c
line wrap: on
line diff
--- a/widgets/ItemEditDialog.cpp	Wed Jul 04 17:22:12 2007 +0000
+++ b/widgets/ItemEditDialog.cpp	Thu Jul 05 11:07:01 2007 +0000
@@ -23,6 +23,7 @@
 #include <QLabel>
 #include <QPushButton>
 #include <QGroupBox>
+#include <QDialogButtonBox>
 
 #include <float.h> // for FLT_MIN/MAX
 
@@ -172,18 +173,16 @@
     } else if (options & ShowValue) {
         m_valueSpinBox->setFocus(Qt::OtherFocusReason);
     }
-
-    QHBoxLayout *hbox = new QHBoxLayout;
-    grid->addLayout(hbox, row, 0, 1, 2);
+    
+    QDialogButtonBox *bb = new QDialogButtonBox(Qt::Horizontal);
+    grid->addWidget(bb, row, 0, 1, 2);
     
     QPushButton *ok = new QPushButton(tr("OK"));
     m_resetButton = new QPushButton(tr("Reset"));
     QPushButton *cancel = new QPushButton(tr("Cancel"));
-    hbox->addStretch(10);
-    hbox->addWidget(ok);
-    hbox->addWidget(m_resetButton);
-    hbox->addWidget(cancel);
-    ok->setDefault(true);
+    bb->addButton(ok, QDialogButtonBox::AcceptRole);
+    bb->addButton(m_resetButton, QDialogButtonBox::ResetRole);
+    bb->addButton(cancel, QDialogButtonBox::RejectRole);
     connect(ok, SIGNAL(clicked()), this, SLOT(accept()));
     connect(m_resetButton, SIGNAL(clicked()), this, SLOT(reset()));
     connect(cancel, SIGNAL(clicked()), this, SLOT(reject()));