forked from Boria138/PortProtonQt
feat: add change_cursor parameter to ClickableLabel for EGS
Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
This commit is contained in:
parent
a31c9dc186
commit
2971a594dc
@ -133,7 +133,7 @@ class FlowLayout(QLayout):
|
|||||||
class ClickableLabel(QLabel):
|
class ClickableLabel(QLabel):
|
||||||
clicked = Signal()
|
clicked = Signal()
|
||||||
|
|
||||||
def __init__(self, *args, icon=None, icon_size=16, icon_space=5, **kwargs):
|
def __init__(self, *args, icon=None, icon_size=16, icon_space=5, change_cursor=True, **kwargs):
|
||||||
"""
|
"""
|
||||||
Поддерживаются вызовы:
|
Поддерживаются вызовы:
|
||||||
- ClickableLabel("текст", parent=...) – первый аргумент строка,
|
- ClickableLabel("текст", parent=...) – первый аргумент строка,
|
||||||
@ -143,6 +143,7 @@ class ClickableLabel(QLabel):
|
|||||||
icon: QIcon или None – иконка, которая будет отрисована вместе с текстом.
|
icon: QIcon или None – иконка, которая будет отрисована вместе с текстом.
|
||||||
icon_size: int – размер иконки (ширина и высота).
|
icon_size: int – размер иконки (ширина и высота).
|
||||||
icon_space: int – отступ между иконкой и текстом.
|
icon_space: int – отступ между иконкой и текстом.
|
||||||
|
change_cursor: bool – изменять ли курсор на PointingHandCursor при наведении (по умолчанию True).
|
||||||
"""
|
"""
|
||||||
if args and isinstance(args[0], str):
|
if args and isinstance(args[0], str):
|
||||||
text = args[0]
|
text = args[0]
|
||||||
@ -161,6 +162,7 @@ class ClickableLabel(QLabel):
|
|||||||
self._icon = icon
|
self._icon = icon
|
||||||
self._icon_size = icon_size
|
self._icon_size = icon_size
|
||||||
self._icon_space = icon_space
|
self._icon_space = icon_space
|
||||||
|
if change_cursor:
|
||||||
self.setCursor(Qt.CursorShape.PointingHandCursor)
|
self.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||||
|
|
||||||
def setIcon(self, icon):
|
def setIcon(self, icon):
|
||||||
|
@ -164,6 +164,7 @@ class GameCard(QFrame):
|
|||||||
parent=coverWidget,
|
parent=coverWidget,
|
||||||
icon_size=16,
|
icon_size=16,
|
||||||
icon_space=5,
|
icon_space=5,
|
||||||
|
change_cursor=False
|
||||||
)
|
)
|
||||||
self.egsLabel.setStyleSheet(self.theme.STEAM_BADGE_STYLE)
|
self.egsLabel.setStyleSheet(self.theme.STEAM_BADGE_STYLE)
|
||||||
self.egsLabel.setFixedWidth(int(card_width * 2/3)) # Устанавливаем ширину в 2/3 ширины карточки
|
self.egsLabel.setFixedWidth(int(card_width * 2/3)) # Устанавливаем ширину в 2/3 ширины карточки
|
||||||
|
@ -1440,6 +1440,7 @@ class MainWindow(QMainWindow):
|
|||||||
parent=coverFrame,
|
parent=coverFrame,
|
||||||
icon_size=16,
|
icon_size=16,
|
||||||
icon_space=5,
|
icon_space=5,
|
||||||
|
change_cursor=False
|
||||||
)
|
)
|
||||||
egsLabel.setStyleSheet(self.theme.STEAM_BADGE_STYLE)
|
egsLabel.setStyleSheet(self.theme.STEAM_BADGE_STYLE)
|
||||||
egsLabel.setFixedWidth(badge_width)
|
egsLabel.setFixedWidth(badge_width)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user