From 14e175387958905e1d274c849570308113cb7755 Mon Sep 17 00:00:00 2001 From: dreamsourcelabTAI Date: Thu, 2 Jun 2022 17:56:28 +0800 Subject: [PATCH] fix: When the display scale is 150%,window can't be maximized --- DSView/pv/dialogs/decoderoptionsdlg.cpp | 4 ++-- DSView/pv/dialogs/deviceoptions.cpp | 1 + DSView/pv/mainframe.cpp | 14 +++++++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/DSView/pv/dialogs/decoderoptionsdlg.cpp b/DSView/pv/dialogs/decoderoptionsdlg.cpp index 6d8b1a5b..f06dba19 100644 --- a/DSView/pv/dialogs/decoderoptionsdlg.cpp +++ b/DSView/pv/dialogs/decoderoptionsdlg.cpp @@ -179,8 +179,8 @@ void DecoderOptionsDlg::load_options(view::DecodeTrace *trace) double sk = QGuiApplication::primaryScreen()->devicePixelRatio(); int srcHeight = QGuiApplication::primaryScreen()->availableSize().height(); - if (srcHeight > 700) - srcHeight = 700; + if (srcHeight > 600) + srcHeight = 600; if (h * sk > srcHeight) { diff --git a/DSView/pv/dialogs/deviceoptions.cpp b/DSView/pv/dialogs/deviceoptions.cpp index a07bef93..81140658 100755 --- a/DSView/pv/dialogs/deviceoptions.cpp +++ b/DSView/pv/dialogs/deviceoptions.cpp @@ -93,6 +93,7 @@ DeviceOptions::DeviceOptions(QWidget *parent, DevInst *dev_inst) : _mode_check.setInterval(100); _mode_check.start(); + } DeviceOptions::~DeviceOptions(){ diff --git a/DSView/pv/mainframe.cpp b/DSView/pv/mainframe.cpp index 0977b432..36bd26a6 100644 --- a/DSView/pv/mainframe.cpp +++ b/DSView/pv/mainframe.cpp @@ -206,7 +206,18 @@ void MainFrame::showNormal() void MainFrame::showMaximized() { hide_border(); - QFrame::showMaximized(); + +#ifdef _WIN32 + double sk = QGuiApplication::primaryScreen()->devicePixelRatio(); + if (sk >= 1.5) + { + auto rect = QGuiApplication::primaryScreen()->availableGeometry(); + this->move(rect.left(), rect.top()); + this->resize(rect.width(), rect.height()); + } +#endif + + QFrame::showMaximized(); } void MainFrame::showMinimized() @@ -426,6 +437,7 @@ void MainFrame::readSettings() bool bReset = false; + //size from config is error if (right == 0) { bReset = true;