From 491dfb37394b18fa456c399bb210adb3204a2105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Fri, 2 Aug 2024 23:08:57 +0800 Subject: [PATCH] fix --- LunaTranslator/LunaTranslator/gui/translatorUI.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/LunaTranslator/LunaTranslator/gui/translatorUI.py b/LunaTranslator/LunaTranslator/gui/translatorUI.py index 2e7bebf0..bc1afa0a 100644 --- a/LunaTranslator/LunaTranslator/gui/translatorUI.py +++ b/LunaTranslator/LunaTranslator/gui/translatorUI.py @@ -94,7 +94,7 @@ class ButtonBar(QFrame): self.threelayout.addStretch() self._right = __(self.threelayout) self.setLayout(self.threelayout) - + self.cntbtn = 0 self.buttons = {} self.stylebuttons = {} self.iconstate = {} @@ -211,8 +211,13 @@ class ButtonBar(QFrame): globalconfig["toolbutton"]["buttons"][name]["align"] ] button.showinlayout(layout) - cnt += button.width() - self.parent().setMinimumWidth(cnt) + cnt += 1 + self.cntbtn = cnt + self.adjustminwidth() + + def adjustminwidth(self): + w = self.cntbtn * self.height() * 2 / 1.5 + self.parent().setMinimumWidth(int(w)) class QUnFrameWindow(resizableframeless): @@ -443,6 +448,7 @@ class QUnFrameWindow(resizableframeless): def refreshtoolicon(self): self.titlebar.setFixedHeight(int(globalconfig["buttonsize"] * 1.5)) + self.titlebar.adjustminwidth() self.titlebar.refreshtoolicon() self.setMinimumHeight(self.titlebar.height() * 2) self.set_color_transparency()