From b7dc8e1d55cf24f5609aa9937b92b9e777db2769 Mon Sep 17 00:00:00 2001 From: Zzaphkiel <1278228162@qq.com> Date: Tue, 7 Nov 2023 23:24:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AF=B9=E5=B1=80=E7=94=9F?= =?UTF-8?q?=E6=B6=AF=E7=95=8C=E9=9D=A2=E5=9B=A0=E5=8F=AC=E5=94=A4=E5=B8=88?= =?UTF-8?q?=E5=90=8D=E5=AD=97=E6=8D=A2=E8=A1=8C=E4=BB=A5=E5=8F=8A=E5=AF=B9?= =?UTF-8?q?=E5=B1=80=E6=95=B0=E9=87=8F=E4=B8=8D=E8=B6=B3=2011=20=E4=BA=A7?= =?UTF-8?q?=E7=94=9F=E7=9A=84=E5=90=84=E7=A7=8D=E6=98=BE=E7=A4=BA=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/view/game_info_interface.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/app/view/game_info_interface.py b/app/view/game_info_interface.py index 2a3be69f..3759b6d2 100644 --- a/app/view/game_info_interface.py +++ b/app/view/game_info_interface.py @@ -525,14 +525,22 @@ def __init__(self, summoner, parent=None): self.summonerName.clicked.connect(lambda: self.parent().parent( ).parent().summonerGamesClicked.emit(self.summonerName.text())) + # self.summonerName.setFixedHeight(35) + + warped = False + if QWidget().fontMetrics().size(Qt.TextSingleLine, name).width() > 50 and len(name) > 8: pos = (len(name)+1) // 2 name = name[:pos] + "\n" + name[pos:] self.summonerName.setText(name) + warped = True + + sp1, sp2 = (-2, 2) if warped else (8, 11) - self.vBoxLayout.addSpacing(5) + self.vBoxLayout.addSpacing(sp1) self.vBoxLayout.addWidget(self.summonerName, alignment=Qt.AlignCenter) - self.vBoxLayout.addSpacing(10) + self.vBoxLayout.addSpacing(sp2) + self.vBoxLayout.addLayout(self.gamesLayout) self.gamesLayout.setContentsMargins(0, 0, 0, 0) @@ -543,8 +551,8 @@ def __init__(self, summoner, parent=None): self.gamesLayout.addWidget(tab, stretch=1) if len(games) < 11: - self.gamesLayout.addSpacing(5) self.gamesLayout.addStretch(11-len(games)) + self.gamesLayout.addSpacing(5) class GameTab(QFrame):