From 313cb514c47ee0ec1aab142c31829b9a586ecbb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <1173718158@qq.com> Date: Wed, 13 Nov 2024 22:26:02 +0800 Subject: [PATCH] fix --- cpp/version.cmake | 2 +- py/LunaTranslator/gui/usefulwidget.py | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/cpp/version.cmake b/cpp/version.cmake index a9b01cb7..92f805e3 100644 --- a/cpp/version.cmake +++ b/cpp/version.cmake @@ -1,7 +1,7 @@ set(VERSION_MAJOR 5) set(VERSION_MINOR 58) -set(VERSION_PATCH 6) +set(VERSION_PATCH 7) set(VERSION_REVISION 0) add_definitions(-DVERSION_MAJOR=${VERSION_MAJOR}) add_definitions(-DVERSION_MINOR=${VERSION_MINOR}) diff --git a/py/LunaTranslator/gui/usefulwidget.py b/py/LunaTranslator/gui/usefulwidget.py index 056b547a..46c313ab 100644 --- a/py/LunaTranslator/gui/usefulwidget.py +++ b/py/LunaTranslator/gui/usefulwidget.py @@ -806,7 +806,7 @@ class resizableframeless(saveposwindow): self.starth - (gpos.y() - self.starty), ) elif self._corner_drag_zuoshang: - self.setGeometry( + self.setgeokeepminsize( (gpos - self.startxp).x(), (gpos - self.startxp).y(), self.startw - (gpos.x() - self.startx), @@ -814,7 +814,7 @@ class resizableframeless(saveposwindow): ) elif self._left_drag: - self.setGeometry( + self.setgeokeepminsize( (gpos - self.startxp).x(), self.y(), self.startw - (gpos.x() - self.startx), @@ -823,14 +823,14 @@ class resizableframeless(saveposwindow): elif self._bottom_drag: self.resize(self.width(), pos.y()) elif self._top_drag: - self.setGeometry( + self.setgeokeepminsize( self.x(), (gpos - self.startxp).y(), self.width(), self.starth - (gpos.y() - self.starty), ) elif self._corner_drag_zuoxia: - self.setGeometry( + self.setgeokeepminsize( (gpos - self.startxp).x(), self.y(), self.startw - (gpos.x() - self.startx), @@ -844,6 +844,13 @@ class resizableframeless(saveposwindow): def mouseReleaseEvent(self, e: QMouseEvent): self.resetflags() + def setgeokeepminsize(self, x, y, w, h): + width = max(w, self.minimumWidth()) + height = max(h, self.minimumHeight()) + x -= width - w + y -= height - h + self.setGeometry(x, y, width, height) + class Prompt_dialog(LDialog): def __init__(self, parent, title, info, items) -> None: @@ -1108,7 +1115,7 @@ def selectcolor( def getboxlayout( - widgets, lc=QHBoxLayout, margin0=False, makewidget=False, delay=False, both=False, space0=False + widgets, lc=QHBoxLayout, margin0=False, makewidget=False, delay=False, both=False ): cp_layout = lc() @@ -1126,8 +1133,6 @@ def getboxlayout( _do = functools.partial(__do, cp_layout, widgets) if margin0: cp_layout.setContentsMargins(0, 0, 0, 0) - if space0: - cp_layout.setSpacing(0) if not delay: _do() if makewidget: