From a8ef173e0842f86e472033d08fef6ab2d6349682 Mon Sep 17 00:00:00 2001 From: dreamsourcelabTAI Date: Mon, 26 Feb 2024 16:33:34 +0800 Subject: [PATCH] Set the min and max size, top >= 0 --- DSView/pv/mainframe.cpp | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/DSView/pv/mainframe.cpp b/DSView/pv/mainframe.cpp index 1570173c..649a8266 100644 --- a/DSView/pv/mainframe.cpp +++ b/DSView/pv/mainframe.cpp @@ -91,11 +91,12 @@ MainFrame::MainFrame() setAttribute(Qt::WA_TranslucentBackground); _is_native_title = false; #endif - - - + // setMinimumWidth(MainWindow::Min_Width); // setMinimumHeight(MainWindow::Min_Height); + + setMinimumWidth(300); + setMinimumHeight(400); // Set the window icon QIcon icon; @@ -199,12 +200,15 @@ void MainFrame::AttachNativeWindow() #ifdef _WIN32 int k = QApplication::desktop()->screen()->devicePixelRatio(); - QRect rc = geometry(); + int x = _initWndInfo.r.x; + int y = _initWndInfo.r.y; + int w = _initWndInfo.r.w; + int h = _initWndInfo.r.h; - int x = rc.left() * k; - int y = rc.top() * k; - int w = rc.width() * k; - int h = rc.height() * k; + x *= k; + y *= k; + w *= k; + h *= k; if (_parentNativeWidget != NULL){ _parentNativeWidget->SetChildWidget(NULL); @@ -234,6 +238,7 @@ void MainFrame::AttachNativeWindow() if (_initWndInfo.isMaxSize){ showMaximized(); } + _parentNativeWidget->ResizeChild(); }); } @@ -284,6 +289,13 @@ void MainFrame::MoveBegin() void MainFrame::MoveEnd() { + QRect rc = GetFormRegion(); + + if (rc.top() < 0){ + dsv_info("The top is out of range."); + rc.setY(0); + SetFormRegion(rc.x(), rc.y(), rc.width(), rc.height()); + } saveNormalRegion();