Mercurial > hg > svgui
comparison widgets/CSVFormatDialog.cpp @ 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 | 22b72f0f6a4e |
children | 24d1d1528717 |
comparison
equal
deleted
inserted
replaced
511:455810e65543 | 512:ed65126e503d |
---|---|
21 #include <QHBoxLayout> | 21 #include <QHBoxLayout> |
22 #include <QVBoxLayout> | 22 #include <QVBoxLayout> |
23 #include <QTableWidget> | 23 #include <QTableWidget> |
24 #include <QComboBox> | 24 #include <QComboBox> |
25 #include <QLabel> | 25 #include <QLabel> |
26 #include <QDialogButtonBox> | |
26 | 27 |
27 | 28 |
28 CSVFormatDialog::CSVFormatDialog(QWidget *parent, CSVFormat format, | 29 CSVFormatDialog::CSVFormatDialog(QWidget *parent, CSVFormat format, |
29 size_t defaultSampleRate) : | 30 size_t defaultSampleRate) : |
30 QDialog(parent), | 31 QDialog(parent), |
120 m_exampleWidget = new QTableWidget | 121 m_exampleWidget = new QTableWidget |
121 (std::min(10, m_example.size()), m_maxExampleCols); | 122 (std::min(10, m_example.size()), m_maxExampleCols); |
122 | 123 |
123 layout->addWidget(m_exampleWidget, 6, 0, 1, 4); | 124 layout->addWidget(m_exampleWidget, 6, 0, 1, 4); |
124 layout->setColumnStretch(3, 10); | 125 layout->setColumnStretch(3, 10); |
125 layout->setRowStretch(4, 10); | 126 layout->setRowStretch(6, 10); |
126 | 127 |
127 QPushButton *ok = new QPushButton(tr("OK")); | 128 QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok | |
128 connect(ok, SIGNAL(clicked()), this, SLOT(accept())); | 129 QDialogButtonBox::Cancel); |
129 ok->setDefault(true); | 130 layout->addWidget(bb, 7, 0, 1, 4); |
130 | 131 connect(bb, SIGNAL(accepted()), this, SLOT(accept())); |
131 QPushButton *cancel = new QPushButton(tr("Cancel")); | 132 connect(bb, SIGNAL(rejected()), this, SLOT(reject())); |
132 connect(cancel, SIGNAL(clicked()), this, SLOT(reject())); | 133 |
133 | 134 setLayout(layout); |
134 QHBoxLayout *buttonLayout = new QHBoxLayout; | 135 |
135 buttonLayout->addStretch(1); | |
136 buttonLayout->addWidget(ok); | |
137 buttonLayout->addWidget(cancel); | |
138 | |
139 QVBoxLayout *mainLayout = new QVBoxLayout; | |
140 mainLayout->addLayout(layout); | |
141 mainLayout->addLayout(buttonLayout); | |
142 | |
143 setLayout(mainLayout); | |
144 | |
145 timingTypeChanged(m_timingTypeCombo->currentIndex()); | 136 timingTypeChanged(m_timingTypeCombo->currentIndex()); |
146 } | 137 } |
147 | 138 |
148 CSVFormatDialog::~CSVFormatDialog() | 139 CSVFormatDialog::~CSVFormatDialog() |
149 { | 140 { |