2
0
forked from Ivasoft/DSView

fix: the selected channel index can't restore on measure pannel

This commit is contained in:
dreamsourcelabTAI
2024-04-11 10:17:32 +08:00
parent f79a231de2
commit 69b8397304
2 changed files with 34 additions and 1 deletions

View File

@@ -59,6 +59,7 @@ MeasureDock::MeasureDock(QWidget *parent, View &view, SigSession *session) :
_dist_pannel = NULL;
_edge_pannel = NULL;
_bSetting = false;
_mouse_groupBox = new QGroupBox(_widget);
_fen_checkBox = new QCheckBox(_widget);
@@ -226,10 +227,18 @@ void MeasureDock::reload()
else
_edge_groupBox->setVisible(false);
_bSetting = true;
for (auto &o : _edge_row_list){
update_probe_selector(o.box);
if (o.channelIndex < o.box->count()){
o.box->setCurrentIndex(o.channelIndex);
}
}
_bSetting = false;
reCalc();
}
@@ -344,6 +353,7 @@ void MeasureDock::add_dist_measure()
inf.start_bt = NULL;
inf.end_bt = NULL;
inf.r_label = NULL;
inf.channelIndex = 0;
_dist_row_list.push_back(inf);
@@ -418,6 +428,9 @@ void MeasureDock::build_edge_pannel()
a_label->setContentsMargins(0,0,0,0);
QComboBox *ch_cmb = create_probe_selector(row_widget);
ch_cmb->setFixedWidth(60);
if (o.channelIndex < ch_cmb->count()){
ch_cmb->setCurrentIndex(o.channelIndex);
}
row_layout->addWidget(del_btn);
row_layout->addSpacing(5);
@@ -462,12 +475,28 @@ void MeasureDock::build_edge_pannel()
connect(del_btn, SIGNAL(clicked()), this, SLOT(del_edge_measure()));
connect(s_btn, SIGNAL(clicked()), this, SLOT(show_all_coursor()));
connect(e_btn, SIGNAL(clicked()), this, SLOT(show_all_coursor()));
connect(ch_cmb, SIGNAL(currentIndexChanged(int)), this, SLOT(update_edge()));
connect(ch_cmb, SIGNAL(currentIndexChanged(int)), this, SLOT(on_edge_channel_selected()));
}
_edge_layout->addWidget(_edge_pannel, 1, 0, 1, 7);
}
void MeasureDock::on_edge_channel_selected()
{
QComboBox *box = dynamic_cast<QComboBox*>(sender());
if (box != NULL && !_bSetting){
for (auto &o : _edge_row_list)
{
if (o.box == box){
o.channelIndex = box->currentIndex();
break;
}
}
}
update_edge();
}
void MeasureDock::add_edge_measure()
{
if (_edge_row_list.size() < Max_Measure_Limits)
@@ -480,6 +509,7 @@ void MeasureDock::add_edge_measure()
inf.start_bt = NULL;
inf.end_bt = NULL;
inf.r_label = NULL;
inf.channelIndex = 0;
_edge_row_list.push_back(inf);
build_edge_pannel();

View File

@@ -64,6 +64,7 @@ struct cursor_row_info
QComboBox *box;
int cursor1;
int cursor2;
id_t channelIndex;
};
struct cursor_opt_info
@@ -119,6 +120,7 @@ private slots:
void del_cursor();
void add_dist_measure();
void on_edge_channel_selected();
public slots:
void cursor_update();
@@ -163,6 +165,7 @@ private:
QLabel *_p_label;
QLabel *_f_label;
QLabel *_d_label;
bool _bSetting;
};
} // namespace dock