From 6f64dd1e923509500751a8b7599f85d1b17dcb25 Mon Sep 17 00:00:00 2001 From: dreamsourcelabTAI Date: Wed, 1 Jun 2022 10:09:23 +0800 Subject: [PATCH] update: Decoder Options dialog adaptive screen size --- DSView/pv/dialogs/decoderoptionsdlg.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/DSView/pv/dialogs/decoderoptionsdlg.cpp b/DSView/pv/dialogs/decoderoptionsdlg.cpp index 0bf32cbb..09734d2d 100644 --- a/DSView/pv/dialogs/decoderoptionsdlg.cpp +++ b/DSView/pv/dialogs/decoderoptionsdlg.cpp @@ -29,7 +29,9 @@ #include #include #include -#include +#include +#include +#include #include "../data/decoderstack.h" #include "../prop/binding/decoderoptions.h" @@ -173,18 +175,23 @@ void DecoderOptionsDlg::load_options(view::DecodeTrace *trace) // scroll QSize tsize = dlg->sizeHint(); int w = tsize.width(); - int h = tsize.height(); + int h = tsize.height(); - if (h > 700) + double sk = QGuiApplication::primaryScreen()->devicePixelRatio(); + int srcHeight = QGuiApplication::primaryScreen()->availableSize().height(); + if (srcHeight > 700) + srcHeight = 700; + + if (h * sk > srcHeight) { int other_height = 235; QScrollArea *scroll = new QScrollArea(scroll_pannel); scroll->setWidget(decoder_container); scroll->setStyleSheet("QScrollArea{border:none;}"); scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - dlg->setFixedSize(w + 20, 700); - scroll_pannel->setFixedSize(w, 700 - other_height); - scroll->setFixedSize(w - 18, 700 - other_height); + dlg->setFixedSize(w + 20, srcHeight); + scroll_pannel->setFixedSize(w, srcHeight - other_height); + scroll->setFixedSize(w - 18, srcHeight - other_height); } connect(_start_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(on_region_set(int)));