• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythongamewindowsbathyscaphephpguic翻訳omegattwitterframeworktestbtronarduinovb.net計画中(planning stage)directxpreviewerゲームエンジンdom

QtSDK と NI-DAQmxBase (Linux) を使った単純なサンプル


Commit MetaInfo

Revisãof07ab5c8e430950d33b79fd55a2fa405b2cc8947 (tree)
Hora2012-09-24 13:56:55
Autorarakaki <alucky4416@user...>
Commiterarakaki

Mensagem de Log

CHG: split Frequency Widget, Dial and ComboBox(scale).

Mudança Sumário

Diff

--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -7,6 +7,8 @@
77 #include <QRegExp>
88 #include <QRegExpValidator>
99
10+#include <QtCore/qmath.h> // qPow()
11+
1012 MainWindow::MainWindow(QWidget *parent) :
1113 QMainWindow(parent),
1214 ui(new Ui::MainWindow)
@@ -24,8 +26,8 @@ MainWindow::MainWindow(QWidget *parent) :
2426 ui->pushButton_Output->setEnabled(false);
2527 ui->pushButton_Output->setText("ON");
2628
27- ui->doubleSpinBox_Freq->setValue(1000.0);
28- ui->dial_Freq->setValue(1000);
29+// ui->doubleSpinBox_Freq->setValue(1.0);
30+// ui->dial_Freq->setValue(1);
2931
3032 ui->doubleSpinBox_Duty->setValue(50.0);
3133 ui->horizontalSlider_Duty->setValue(50);
@@ -80,16 +82,18 @@ void MainWindow::on_pushButton_Output_clicked()
8082 }
8183 }
8284
83-void MainWindow::on_doubleSpinBox_Freq_valueChanged(double arg1)
85+void MainWindow::on_dial_Freq_valueChanged(int value)
8486 {
85- ui->dial_Freq->setValue((int)arg1);
87+ ui->doubleSpinBox_Freq->setValue((double)(value * (qPow(10.0, ui->comboBox_FreqScale->currentIndex()))));
8688
8789 DaqTh->changePulseOutput((float)ui->doubleSpinBox_Freq->value(), (float)ui->doubleSpinBox_Duty->value());
8890 }
8991
90-void MainWindow::on_dial_Freq_valueChanged(int value)
92+void MainWindow::on_comboBox_FreqScale_currentIndexChanged(int index)
9193 {
92- ui->doubleSpinBox_Freq->setValue((double)value);
94+ ui->doubleSpinBox_Freq->setValue((double)(ui->dial_Freq->value() * qPow(10.0, index)));
95+
96+ DaqTh->changePulseOutput((float)ui->doubleSpinBox_Freq->value(), (float)ui->doubleSpinBox_Duty->value());
9397 }
9498
9599 void MainWindow::on_doubleSpinBox_Duty_valueChanged(double arg1)
@@ -131,3 +135,4 @@ void MainWindow::pulse_output_stopped()
131135 {
132136 ui->statusBar->showMessage("Idle...");
133137 }
138+
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -22,10 +22,10 @@ private slots:
2222
2323 void on_pushButton_Output_clicked();
2424
25- void on_doubleSpinBox_Freq_valueChanged(double arg1);
26-
2725 void on_doubleSpinBox_Duty_valueChanged(double arg1);
2826
27+ void on_comboBox_FreqScale_currentIndexChanged(int index);
28+
2929 void on_dial_Freq_valueChanged(int value);
3030
3131 void on_horizontalSlider_Duty_valueChanged(int value);
@@ -36,8 +36,6 @@ private slots:
3636 void pulse_output_started();
3737 void pulse_output_stopped();
3838
39-
40-
4139 private:
4240 Ui::MainWindow *ui;
4341
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -15,14 +15,20 @@
1515 </property>
1616 <widget class="QWidget" name="centralWidget">
1717 <widget class="QDoubleSpinBox" name="doubleSpinBox_Freq">
18+ <property name="enabled">
19+ <bool>true</bool>
20+ </property>
1821 <property name="geometry">
1922 <rect>
2023 <x>80</x>
21- <y>260</y>
24+ <y>270</y>
2225 <width>101</width>
2326 <height>31</height>
2427 </rect>
2528 </property>
29+ <property name="readOnly">
30+ <bool>true</bool>
31+ </property>
2632 <property name="suffix">
2733 <string>Hz</string>
2834 </property>
@@ -36,14 +42,14 @@
3642 <double>1.000000000000000</double>
3743 </property>
3844 <property name="value">
39- <double>1000.000000000000000</double>
45+ <double>1.000000000000000</double>
4046 </property>
4147 </widget>
4248 <widget class="QLabel" name="label">
4349 <property name="geometry">
4450 <rect>
4551 <x>40</x>
46- <y>110</y>
52+ <y>100</y>
4753 <width>121</width>
4854 <height>18</height>
4955 </rect>
@@ -61,7 +67,7 @@
6167 <widget class="QPushButton" name="pushButton_Output">
6268 <property name="geometry">
6369 <rect>
64- <x>280</x>
70+ <x>340</x>
6571 <y>250</y>
6672 <width>141</width>
6773 <height>51</height>
@@ -99,7 +105,7 @@
99105 <widget class="QLabel" name="label_2">
100106 <property name="geometry">
101107 <rect>
102- <x>280</x>
108+ <x>340</x>
103109 <y>230</y>
104110 <width>101</width>
105111 <height>18</height>
@@ -173,7 +179,7 @@
173179 <property name="geometry">
174180 <rect>
175181 <x>30</x>
176- <y>120</y>
182+ <y>140</y>
177183 <width>181</width>
178184 <height>131</height>
179185 </rect>
@@ -182,19 +188,19 @@
182188 <number>1</number>
183189 </property>
184190 <property name="maximum">
185- <number>1000000</number>
191+ <number>9</number>
186192 </property>
187193 <property name="singleStep">
188- <number>1000</number>
194+ <number>1</number>
189195 </property>
190196 <property name="pageStep">
191197 <number>1</number>
192198 </property>
193199 <property name="value">
194- <number>1000</number>
200+ <number>1</number>
195201 </property>
196202 <property name="sliderPosition">
197- <number>1000</number>
203+ <number>1</number>
198204 </property>
199205 <property name="tracking">
200206 <bool>false</bool>
@@ -206,7 +212,7 @@
206212 <bool>false</bool>
207213 </property>
208214 <property name="notchTarget">
209- <double>100.000000000000000</double>
215+ <double>1.000000000000000</double>
210216 </property>
211217 <property name="notchesVisible">
212218 <bool>true</bool>
@@ -215,7 +221,7 @@
215221 <widget class="QLabel" name="label_5">
216222 <property name="geometry">
217223 <rect>
218- <x>290</x>
224+ <x>350</x>
219225 <y>310</y>
220226 <width>191</width>
221227 <height>20</height>
@@ -229,7 +235,7 @@
229235 <property name="geometry">
230236 <rect>
231237 <x>60</x>
232- <y>230</y>
238+ <y>250</y>
233239 <width>21</width>
234240 <height>18</height>
235241 </rect>
@@ -242,13 +248,13 @@
242248 <property name="geometry">
243249 <rect>
244250 <x>170</x>
245- <y>230</y>
251+ <y>250</y>
246252 <width>61</width>
247253 <height>18</height>
248254 </rect>
249255 </property>
250256 <property name="text">
251- <string>1000000</string>
257+ <string>9</string>
252258 </property>
253259 </widget>
254260 <widget class="QComboBox" name="comboBox_DevName">
@@ -303,6 +309,54 @@
303309 <string>DevName</string>
304310 </property>
305311 </widget>
312+ <widget class="QComboBox" name="comboBox_FreqScale">
313+ <property name="geometry">
314+ <rect>
315+ <x>207</x>
316+ <y>190</y>
317+ <width>81</width>
318+ <height>28</height>
319+ </rect>
320+ </property>
321+ <property name="maxCount">
322+ <number>2147483645</number>
323+ </property>
324+ <item>
325+ <property name="text">
326+ <string>1</string>
327+ </property>
328+ </item>
329+ <item>
330+ <property name="text">
331+ <string>10</string>
332+ </property>
333+ </item>
334+ <item>
335+ <property name="text">
336+ <string>100</string>
337+ </property>
338+ </item>
339+ <item>
340+ <property name="text">
341+ <string>1k</string>
342+ </property>
343+ </item>
344+ <item>
345+ <property name="text">
346+ <string>10k</string>
347+ </property>
348+ </item>
349+ <item>
350+ <property name="text">
351+ <string>100k</string>
352+ </property>
353+ </item>
354+ <item>
355+ <property name="text">
356+ <string>1M</string>
357+ </property>
358+ </item>
359+ </widget>
306360 </widget>
307361 <widget class="QMenuBar" name="menuBar">
308362 <property name="geometry">