Mercurial > hg > svgui
comparison 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 |
comparison
equal
deleted
inserted
replaced
281:ac58acbd7482 | 282:4edaff85875d |
---|---|
19 #include <QHBoxLayout> | 19 #include <QHBoxLayout> |
20 #include <QLabel> | 20 #include <QLabel> |
21 #include <QStringList> | 21 #include <QStringList> |
22 #include <QRadioButton> | 22 #include <QRadioButton> |
23 #include <QPushButton> | 23 #include <QPushButton> |
24 #include <QDialogButtonBox> | |
24 | 25 |
25 ListInputDialog::ListInputDialog(QWidget *parent, const QString &title, | 26 ListInputDialog::ListInputDialog(QWidget *parent, const QString &title, |
26 const QString &labelText, const QStringList &list, | 27 const QString &labelText, const QStringList &list, |
27 int current, Qt::WFlags f) : | 28 int current, Qt::WFlags f) : |
28 QDialog(parent, f), | 29 QDialog(parent, f), |
47 vbox->addStretch(1); | 48 vbox->addStretch(1); |
48 | 49 |
49 m_footnote = new QLabel; | 50 m_footnote = new QLabel; |
50 vbox->addWidget(m_footnote); | 51 vbox->addWidget(m_footnote); |
51 m_footnote->hide(); | 52 m_footnote->hide(); |
52 | 53 |
53 QHBoxLayout *hbox = new QHBoxLayout; | 54 QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok | |
54 vbox->addLayout(hbox, Qt::AlignRight); | 55 QDialogButtonBox::Cancel); |
55 | 56 vbox->addWidget(bb); |
56 QPushButton *ok = new QPushButton(tr("OK"), this); | 57 connect(bb, SIGNAL(accepted()), this, SLOT(accept())); |
57 ok->setDefault(true); | 58 connect(bb, SIGNAL(rejected()), this, SLOT(reject())); |
58 | |
59 QPushButton *cancel = new QPushButton(tr("Cancel"), this); | |
60 | |
61 QSize bs = ok->sizeHint().expandedTo(cancel->sizeHint()); | |
62 ok->setFixedSize(bs); | |
63 cancel->setFixedSize(bs); | |
64 | |
65 hbox->addStretch(); | |
66 hbox->addWidget(ok); | |
67 hbox->addWidget(cancel); | |
68 | |
69 QObject::connect(ok, SIGNAL(clicked()), this, SLOT(accept())); | |
70 QObject::connect(cancel, SIGNAL(clicked()), this, SLOT(reject())); | |
71 } | 59 } |
72 | 60 |
73 ListInputDialog::~ListInputDialog() | 61 ListInputDialog::~ListInputDialog() |
74 { | 62 { |
75 } | 63 } |