From 6de99fe3a6f884a4616dba21c1dd0aae30b30916 Mon Sep 17 00:00:00 2001 From: dreamsourcelabTAI Date: Tue, 17 Oct 2023 10:54:22 +0800 Subject: [PATCH] fix: Load file with app startup is not optimizing --- DSView/pv/mainwindow.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/DSView/pv/mainwindow.cpp b/DSView/pv/mainwindow.cpp index 56205fd6..f0427331 100644 --- a/DSView/pv/mainwindow.cpp +++ b/DSView/pv/mainwindow.cpp @@ -313,6 +313,8 @@ namespace pv _logo_bar->set_mainform_callback(this); + bool bLoadFile = false; + // Try load from file. QString ldFileName(AppControl::Instance()->_open_file_name.c_str()); if (ldFileName != "") @@ -323,7 +325,8 @@ namespace pv { dsv_info("Auto load file:%s", file_name.c_str()); tmp_file = ldFileName; - + bLoadFile = true; + QTimer::singleShot(300, this, [this](){ on_load_file(tmp_file); tmp_file = ""; @@ -336,7 +339,9 @@ namespace pv } } - _session->set_default_device(); + if (!bLoadFile){ + _session->set_default_device(); + } } //*