add callback for velocity.

This commit is contained in:
pandx 2025-03-28 11:29:30 +08:00
parent 306db57a47
commit 0c217eea58
3 changed files with 131 additions and 3 deletions

View File

@ -28,12 +28,72 @@ Velocity::Velocity(int slot_no_, int channel_, bool active, QWidget *parent)
Init(); Init();
connect(ui->checkBox_1x_ampl, &QCheckBox::toggled, this, &Velocity::on_1x_ampl_toggled); connect(ui->checkBox_1x_ampl, &QCheckBox::toggled, this, &Velocity::on_1x_ampl_toggled);
connect(ui->checkBox_2x_ampl, &QCheckBox::toggled, this, &Velocity::on_2x_ampl_toggled); connect(ui->checkBox_2x_ampl, &QCheckBox::toggled, this, &Velocity::on_2x_ampl_toggled);
connect(ui->checkBox_rms, &QCheckBox::toggled, this, &Velocity::on_rms_toggled);
connect(ui->checkBox_integrate, &QCheckBox::toggled, this, &Velocity::on_integrate_toggled);
} }
Velocity::~Velocity() { Velocity::~Velocity() {
delete ui; delete ui;
} }
void Velocity::on_rms_toggled(bool checked) {
// TODO: 自定义的回调
if (checked) {
ui->checkBox_integrate->setEnabled(false);
QStringList items = {"0-10 mm/s rms", "0-20 mm/s rms", "0-50 mm/s rms", "自定义"};
ui->comboBox_direct_value_range->clear();
ui->comboBox_direct_value_range->addItems(items);
ui->comboBox_direct_value_range->setCurrentIndex(1);
ui->comboBox_1x_value_range->clear();
ui->comboBox_1x_value_range->addItems(items);
ui->comboBox_1x_value_range->setCurrentIndex(1);
ui->comboBox_2x_value_range->clear();
ui->comboBox_2x_value_range->addItems(items);
ui->comboBox_2x_value_range->setCurrentIndex(1);
return;
}
ui->checkBox_integrate->setEnabled(true);
ui->comboBox_direct_value_range->clear();
QStringList items = {"0-10 mm/s pk", "0-20 mm/s pk", "0-50 mm/s pk", "自定义"};
ui->comboBox_direct_value_range->addItems(items);
ui->comboBox_direct_value_range->setCurrentIndex(1);
ui->comboBox_1x_value_range->clear();
ui->comboBox_1x_value_range->addItems(items);
ui->comboBox_1x_value_range->setCurrentIndex(1);
ui->comboBox_2x_value_range->clear();
ui->comboBox_2x_value_range->addItems(items);
ui->comboBox_2x_value_range->setCurrentIndex(1);
}
void Velocity::on_integrate_toggled(bool checked) {
// TODO: 自定义的回调
if (checked) {
ui->checkBox_rms->setEnabled(false);
ui->comboBox_direct_value_range->clear();
QStringList items = {"0-100 um pp", "0-200 um pp", "0-500 um pp", "自定义"};
ui->comboBox_direct_value_range->addItems(items);
ui->comboBox_direct_value_range->setCurrentIndex(1);
ui->comboBox_1x_value_range->clear();
ui->comboBox_1x_value_range->addItems(items);
ui->comboBox_1x_value_range->setCurrentIndex(1);
ui->comboBox_2x_value_range->clear();
ui->comboBox_2x_value_range->addItems(items);
ui->comboBox_2x_value_range->setCurrentIndex(1);
return;
}
ui->checkBox_rms->setEnabled(true);
ui->comboBox_direct_value_range->clear();
QStringList items = {"0-10 mm/s pk", "0-20 mm/s pk", "0-50 mm/s pk", "自定义"};
ui->comboBox_direct_value_range->addItems(items);
ui->comboBox_direct_value_range->setCurrentIndex(1);
ui->comboBox_1x_value_range->clear();
ui->comboBox_1x_value_range->addItems(items);
ui->comboBox_1x_value_range->setCurrentIndex(1);
ui->comboBox_2x_value_range->clear();
ui->comboBox_2x_value_range->addItems(items);
ui->comboBox_2x_value_range->setCurrentIndex(1);
}
void Velocity::on_pushButton_cancel_clicked() { void Velocity::on_pushButton_cancel_clicked() {
this->close(); this->close();
} }

View File

@ -22,6 +22,8 @@ class Velocity : public QWidget {
void on_pushButton_cancel_clicked(); void on_pushButton_cancel_clicked();
void on_1x_ampl_toggled(bool checked); void on_1x_ampl_toggled(bool checked);
void on_2x_ampl_toggled(bool checked); void on_2x_ampl_toggled(bool checked);
void on_rms_toggled(bool checked);
void on_integrate_toggled(bool checked);
private: private:
Ui::Velocity *ui; Ui::Velocity *ui;

View File

@ -376,9 +376,30 @@
<height>22</height> <height>22</height>
</rect> </rect>
</property> </property>
<property name="currentText">
<string>0-20 mm/s pk</string>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<item> <item>
<property name="text"> <property name="text">
<string>0 - 20 mm/s</string> <string>0-10 mm/s pk</string>
</property>
</item>
<item>
<property name="text">
<string>0-20 mm/s pk</string>
</property>
</item>
<item>
<property name="text">
<string>0-50 mm/s pk</string>
</property>
</item>
<item>
<property name="text">
<string>自定义</string>
</property> </property>
</item> </item>
</widget> </widget>
@ -391,6 +412,9 @@
<height>22</height> <height>22</height>
</rect> </rect>
</property> </property>
<property name="decimals">
<number>1</number>
</property>
</widget> </widget>
<widget class="QLabel" name="label_bias_voltage"> <widget class="QLabel" name="label_bias_voltage">
<property name="geometry"> <property name="geometry">
@ -430,9 +454,27 @@
<height>22</height> <height>22</height>
</rect> </rect>
</property> </property>
<property name="currentIndex">
<number>1</number>
</property>
<item> <item>
<property name="text"> <property name="text">
<string>0 - 20 mm/s</string> <string>0-10 mm/s pk</string>
</property>
</item>
<item>
<property name="text">
<string>0-20 mm/s pk</string>
</property>
</item>
<item>
<property name="text">
<string>0-50 mm/s pk</string>
</property>
</item>
<item>
<property name="text">
<string>自定义</string>
</property> </property>
</item> </item>
</widget> </widget>
@ -448,6 +490,9 @@
<height>22</height> <height>22</height>
</rect> </rect>
</property> </property>
<property name="decimals">
<number>1</number>
</property>
</widget> </widget>
<widget class="QLabel" name="label_76"> <widget class="QLabel" name="label_76">
<property name="geometry"> <property name="geometry">
@ -503,6 +548,9 @@
<height>22</height> <height>22</height>
</rect> </rect>
</property> </property>
<property name="decimals">
<number>1</number>
</property>
</widget> </widget>
<widget class="QDoubleSpinBox" name="doubleSpinBox_2x_phase_lag_clamp"> <widget class="QDoubleSpinBox" name="doubleSpinBox_2x_phase_lag_clamp">
<property name="enabled"> <property name="enabled">
@ -532,9 +580,27 @@
<height>22</height> <height>22</height>
</rect> </rect>
</property> </property>
<property name="currentIndex">
<number>1</number>
</property>
<item> <item>
<property name="text"> <property name="text">
<string>0 - 20 mm/s</string> <string>0-10 mm/s pk</string>
</property>
</item>
<item>
<property name="text">
<string>0-20 mm/s pk</string>
</property>
</item>
<item>
<property name="text">
<string>0-50 mm/s pk</string>
</property>
</item>
<item>
<property name="text">
<string>自定义</string>
</property> </property>
</item> </item>
</widget> </widget>