From 828e8b82d988b8bf7328c3d619e947f79e65c062 Mon Sep 17 00:00:00 2001 From: Zzaphkiel <1278228162@qq.com> Date: Thu, 14 Sep 2023 20:23:25 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E7=94=BB=E5=AF=B9=E5=B1=80=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E7=95=8C=E9=9D=A2=EF=BC=8C=E5=8F=96=E6=B6=88=E6=AF=8F?= =?UTF-8?q?=E4=B8=80=E5=88=97=E6=88=98=E7=BB=A9=E7=9A=84=E5=8D=95=E7=8B=AC?= =?UTF-8?q?=E8=BE=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/game_infobar_widget.py | 2 +- app/resource/qss/dark/game_info_interface.qss | 28 ++++++++++--- .../qss/light/game_info_interface.qss | 32 ++++++++++++-- app/view/game_info_interface.py | 42 ++++++++++++------- app/view/search_interface.py | 2 +- 5 files changed, 78 insertions(+), 28 deletions(-) diff --git a/app/components/game_infobar_widget.py b/app/components/game_infobar_widget.py index 72a151d1..66159d7c 100644 --- a/app/components/game_infobar_widget.py +++ b/app/components/game_infobar_widget.py @@ -236,7 +236,7 @@ def __init__(self, game: dict = None, parent: QWidget = None): super().__init__(parent=parent) self.hBoxLayout = QHBoxLayout(self) - self.setProperty('press', False) + self.setProperty('pressed', False) self.gameId = game['gameId'] self.__initWidget(game) diff --git a/app/resource/qss/dark/game_info_interface.qss b/app/resource/qss/dark/game_info_interface.qss index 15ff5169..ccf91b79 100644 --- a/app/resource/qss/dark/game_info_interface.qss +++ b/app/resource/qss/dark/game_info_interface.qss @@ -68,11 +68,15 @@ GameTab>#time { font: 11px; } + Games { - color: white; - border-radius: 6px; - border: 1px solid rgb(82, 82, 82); - background-color: rgba(255, 255, 255, 0.051); + border: none; + border-right: 1px solid rgb(35, 35, 35); + background-color: transparent; +} + +Games[isLast=true] { + border: none; } Games>#summonerName { @@ -81,7 +85,19 @@ Games>#summonerName { } Games:hover { - border-radius: 6px; - border: 1px solid rgb(82, 82, 82); + border: none; + border-radius: 0; + background-color: rgba(255, 255, 255, 0.0837); +} + +Games[isFirst=true]:hover { + border-top-left-radius: 6px; + border-bottom-left-radius: 6px; + background-color: rgba(255, 255, 255, 0.0837); +} + +Games[isLast=true]:hover { + border-top-right-radius: 6px; + border-bottom-right-radius: 6px; background-color: rgba(255, 255, 255, 0.0837); } \ No newline at end of file diff --git a/app/resource/qss/light/game_info_interface.qss b/app/resource/qss/light/game_info_interface.qss index 2df905c2..8de51890 100644 --- a/app/resource/qss/light/game_info_interface.qss +++ b/app/resource/qss/light/game_info_interface.qss @@ -59,18 +59,32 @@ SummonerInfoView>#kdaValLabel { /* border: 1px solid black; */ } +SummonerInfoView>#kdaValLabel { + font: bold; +} + GameTab>QLabel { font: 13px 'Segoe UI', 'Microsoft YaHei'; } GameTab>#time { - font: 11px; + font: bold 11px; } -Games { +/* Games { border-radius: 6px; border: 1px solid rgba(0, 0, 0, 0.095); background-color: rgba(245, 245, 245, 0.667); +} */ + +Games { + border: none; + border-right: 1px solid rgba(0, 0, 0, 0.095); + background-color: transparent; +} + +Games[isLast=true] { + border: none; } Games>#summonerName { @@ -78,7 +92,17 @@ Games>#summonerName { } Games:hover { - border-radius: 6px; - border: 1px solid rgba(0, 0, 0, 0.095); + background-color: rgba(233, 233, 233, 0.5); +} + +Games[isFirst=true]:hover { + border-top-left-radius: 6px; + border-bottom-left-radius: 6px; + background-color: rgba(233, 233, 233, 0.5); +} + +Games[isLast=true]:hover { + border-top-right-radius: 6px; + border-bottom-right-radius: 6px; background-color: rgba(233, 233, 233, 0.5); } \ No newline at end of file diff --git a/app/view/game_info_interface.py b/app/view/game_info_interface.py index 20e4a11f..383f4ab6 100644 --- a/app/view/game_info_interface.py +++ b/app/view/game_info_interface.py @@ -192,17 +192,17 @@ def __init__(self, parent=None): def __initLayout(self): self.vBoxLayout.setContentsMargins(0, 0, 0, 0) + # self.vBoxLayout.setSpacing(0) def updateSummoners(self, summoners): self.clear() for summoner in summoners: summonerView = SummonerInfoView(summoner) - self.vBoxLayout.addWidget(summonerView) + self.vBoxLayout.addWidget(summonerView, stretch=1) if len(summoners) < 5: - self.vBoxLayout.addSpacerItem( - QSpacerItem(1, 1, QSizePolicy.Minimum, QSizePolicy.Expanding)) + self.vBoxLayout.addStretch(5 - len(summoners)) def clear(self): for i in reversed(range(self.vBoxLayout.count())): @@ -362,7 +362,7 @@ def __initLayout(self): self.infoVBoxLayout.addSpacerItem( QSpacerItem(1, 1, QSizePolicy.Minimum, QSizePolicy.Expanding)) - self.hBoxLayout.setContentsMargins(7, 0, 7, 0) + self.hBoxLayout.setContentsMargins(9, 0, 9, 0) self.hBoxLayout.setSpacing(0) self.hBoxLayout.addWidget(self.icon) self.hBoxLayout.addLayout(self.infoVBoxLayout) @@ -409,18 +409,23 @@ def __init__(self, parent=None): def __initLayout(self): self.hBoxLayout.setSpacing(0) + self.hBoxLayout.setContentsMargins(0, 0, 0, 0) def updateSummoners(self, summoners): self.clear() self.summoners = summoners - for summoner in summoners: + for i, summoner in enumerate(summoners): games = Games(summoner) - self.hBoxLayout.addWidget(games, alignment=Qt.AlignHCenter) + self.hBoxLayout.addWidget(games, stretch=1) + + if i == 0: + games.setProperty("isFirst", True) + elif i == len(summoners) - 1: + games.setProperty("isLast", True) if len(summoners) < 5: - self.hBoxLayout.addSpacerItem(QSpacerItem( - 1, 1, QSizePolicy.Expanding, QSizePolicy.Minimum)) + self.hBoxLayout.addStretch(5 - len(summoners)) def clear(self): self.summoners.clear() @@ -440,6 +445,10 @@ def __init__(self, summoner, parent=None): self.vBoxLayout = QVBoxLayout(self) self.vBoxLayout.setSpacing(5) + # self.vBoxLayout.setContentsMargins(0, 0, 0, 0) + + self.setSizePolicy(QSizePolicy.Policy.Expanding, + QSizePolicy.Policy.Expanding) self.summonerName = SummonerName(summoner['name']) self.summonerName.setObjectName("summonerName") @@ -447,8 +456,9 @@ def __init__(self, summoner, parent=None): ).parent().summonerGamesClicked.emit(self.summonerName.text())) # self.vBoxLayout.setContentsMargins(4, 4, 4, 4) + self.vBoxLayout.addSpacing(5) self.vBoxLayout.addWidget(self.summonerName, alignment=Qt.AlignCenter) - # self.vBoxLayout.addSpacing(10) + self.vBoxLayout.addSpacing(10) games = summoner['gamesInfo'] @@ -456,17 +466,17 @@ def __init__(self, summoner, parent=None): tab = GameTab(game) self.vBoxLayout.addWidget(tab) - if len(games) < 11: - self.vBoxLayout.addSpacerItem(QSpacerItem( - 1, 1, QSizePolicy.Expanding, QSizePolicy.Minimum)) + # if len(games) < 11: + # self.vBoxLayout.addSpacerItem(QSpacerItem( + # 1, 1, QSizePolicy.Expanding, QSizePolicy.Minimum)) class GameTab(QFrame): def __init__(self, game=None, parent=None): super().__init__(parent) - self.setFixedHeight(54) - self.setFixedWidth(129) + # self.setFixedHeight(54) + # self.setFixedWidth(129) self.hBoxLayout = QHBoxLayout(self) self.nameTimeKdaLayout = QVBoxLayout() @@ -477,7 +487,7 @@ def __init__(self, game=None, parent=None): self.modeName = QLabel(game['name'].replace("排位赛 ", "")) self.time = QLabel( - f"{game['shortTime']} {game['kills']}/{game['deaths']}/{game['assists']}" + f"{game['shortTime']} {game['kills']}-{game['deaths']}-{game['assists']}" ) self.resultLabel = QLabel() @@ -497,7 +507,7 @@ def __initWidget(self): self.time.setObjectName("time") def __initLayout(self): - self.hBoxLayout.setContentsMargins(4, 9, 4, 9) + self.hBoxLayout.setContentsMargins(7, 9, 7, 9) self.nameTimeKdaLayout.addWidget(self.modeName) self.nameTimeKdaLayout.addWidget(self.time) diff --git a/app/view/search_interface.py b/app/view/search_interface.py index 28951fa4..b9d996c1 100644 --- a/app/view/search_interface.py +++ b/app/view/search_interface.py @@ -831,7 +831,7 @@ def __init__(self, game=None, parent=None): super().__init__(parent) self.setFixedHeight(54) self.setFixedWidth(141) - self.setProperty("press", False) + self.setProperty("pressed", False) self.vBoxLayout = QHBoxLayout(self) self.nameTimeKdaLayout = QVBoxLayout()