Skip to content

Commit

Permalink
修复过长的召唤师名在搜索界面显示不正确的问题 (#249)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zzaphkiel committed Feb 21, 2024
1 parent d6c9cf5 commit 074befd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/resource/qss/dark/search_interface.qss
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ SummonerInfoBar#currentSummonerWidget>#levelLabel {
SummonerName {
font: 14px 'Segoe UI', 'Microsoft YaHei', 'PingFang SC';
text-align: left;
padding: 4px 6px 4px 6px;
padding: 0px 6px 3px 6px;
color: white;
border: none;
background-color: transparent;
Expand Down
2 changes: 1 addition & 1 deletion app/resource/qss/light/search_interface.qss
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ SummonerInfoBar#currentSummonerWidget>QLabel {
SummonerName {
font: 14px 'Segoe UI', 'Microsoft YaHei';
text-align: left;
padding: 4px 6px 4px 6px;
padding: 0px 6px 3px 6px;
color: black;
border: none;
background-color: transparent;
Expand Down
19 changes: 12 additions & 7 deletions app/view/search_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
from PyQt5.QtCore import Qt, pyqtSignal
from PyQt5.QtGui import QPixmap
from ..common.qfluentwidgets import (SmoothScrollArea, LineEdit, PushButton, ToolButton, InfoBar,
InfoBarPosition, ToolTipFilter, ToolTipPosition, Theme, isDarkTheme, FlyoutViewBase, Flyout,
CardWidget, IndeterminateProgressRing, FlyoutView, FlyoutAnimationType, ComboBox,
StateToolTip)
InfoBarPosition, ToolTipFilter, ToolTipPosition, Theme, isDarkTheme, FlyoutViewBase, Flyout,
CardWidget, IndeterminateProgressRing, FlyoutView, FlyoutAnimationType, ComboBox,
StateToolTip)

from ..common.style_sheet import StyleSheet
from ..common.icons import Icon
Expand Down Expand Up @@ -732,7 +732,8 @@ def __init__(self, summoner, parent=None):

self.levelLabel = QLabel()
self.championIconLabel = RoundIcon(summoner["championIcon"], 25, 0, 3)
self.summonerName = SummonerName(summoner["summonerName"], isPublic=summoner["isPublic"])
self.summonerName = SummonerName(
summoner["summonerName"], isPublic=summoner["isPublic"])

self.rankIcon = QLabel()

Expand All @@ -755,6 +756,10 @@ def __initWidget(self, summoner):
if self.isCurrent:
self.setObjectName("currentSummonerWidget")

self.summonerName.setAlignment(Qt.AlignVCenter | Qt.AlignLeft)
self.summonerName.setSizePolicy(
QSizePolicy.Expanding, QSizePolicy.Minimum)

self.runeIcon.setPixmap(QPixmap(summoner["runeIcon"]).scaled(
23, 23, Qt.KeepAspectRatio, Qt.SmoothTransformation))
self.spell1Icon.setFixedSize(18, 18)
Expand Down Expand Up @@ -833,10 +838,10 @@ def __initLayout(self):
self.hBoxLayout.addLayout(self.spellsLayout)
self.hBoxLayout.addWidget(self.levelLabel)
self.hBoxLayout.addWidget(self.championIconLabel)
self.hBoxLayout.addWidget(self.summonerName)
self.hBoxLayout.addSpacing(10)
self.hBoxLayout.addWidget(self.summonerName, alignment=Qt.AlignVCenter)
self.hBoxLayout.addSpacing(4)
self.hBoxLayout.addSpacerItem(QSpacerItem(
1, 1, QSizePolicy.Expanding, QSizePolicy.Minimum))
1, 1, QSizePolicy.Minimum, QSizePolicy.Minimum))
self.hBoxLayout.addSpacing(5)
self.hBoxLayout.addWidget(self.rankIcon)
self.hBoxLayout.addSpacing(5)
Expand Down

0 comments on commit 074befd

Please sign in to comment.