fix: DSO measure error when window resized

This commit is contained in:
DreamSourceLab 2023-09-21 20:05:24 -07:00
parent 9b143615c6
commit 8e83526e47
4 changed files with 28 additions and 5 deletions

View File

@ -106,6 +106,10 @@
namespace pv namespace pv
{ {
namespace{
QString tmp_file;
}
MainWindow::MainWindow(toolbars::TitleBar *title_bar, QWidget *parent) MainWindow::MainWindow(toolbars::TitleBar *title_bar, QWidget *parent)
: QMainWindow(parent) : QMainWindow(parent)
{ {
@ -318,7 +322,12 @@ namespace pv
if (QFile::exists(ldFileName)) if (QFile::exists(ldFileName))
{ {
dsv_info("Auto load file:%s", file_name.c_str()); dsv_info("Auto load file:%s", file_name.c_str());
on_load_file(ldFileName); tmp_file = ldFileName;
QTimer::singleShot(300, this, [this](){
on_load_file(tmp_file);
tmp_file = "";
});
} }
else else
{ {
@ -326,11 +335,9 @@ namespace pv
MsgBox::Show(L_S(STR_PAGE_MSG, S_ID(IDS_MSG_OPEN_FILE_ERROR), "Open file error!"), ldFileName, NULL); MsgBox::Show(L_S(STR_PAGE_MSG, S_ID(IDS_MSG_OPEN_FILE_ERROR), "Open file error!"), ldFileName, NULL);
} }
} }
else
{
_session->set_default_device(); _session->set_default_device();
} }
}
//* //*
void MainWindow::retranslateUi() void MainWindow::retranslateUi()

View File

@ -2447,4 +2447,17 @@ namespace pv
} }
} }
void SigSession::update_dso_data_scale()
{
if (_device_agent.get_work_mode() == DSO)
{
for(auto s : _signals){
if (s->get_type() == SR_CHANNEL_DSO){
view::DsoSignal *ch = (view::DsoSignal*)s;
_capture_data->get_dso()->set_data_scale(ch->get_scale(), ch->get_index());
}
}
}
}
} // namespace pv } // namespace pv

View File

@ -429,6 +429,8 @@ public:
_decoder_pannel = pannel; _decoder_pannel = pannel;
} }
void update_dso_data_scale();
private: private:
void set_cur_samplelimits(uint64_t samplelimits); void set_cur_samplelimits(uint64_t samplelimits);
void set_cur_snap_samplerate(uint64_t samplerate); void set_cur_snap_samplerate(uint64_t samplerate);

View File

@ -778,6 +778,7 @@ void View::signals_changed(const Trace* eventTrace)
} }
} }
_time_viewport->clear_measure(); _time_viewport->clear_measure();
_session->update_dso_data_scale();
} }
header_updated(); header_updated();