add image paths
This commit is contained in:
@ -2,6 +2,7 @@ from PySide6.QtWidgets import QPushButton
|
||||
from PySide6.QtGui import QPainter, QFont, Qt, QPixmap, QColor
|
||||
from PySide6.QtCore import QRectF
|
||||
import resources.resources_rc
|
||||
from utils.image_paths import ImagePaths
|
||||
|
||||
# 用于 开、拱 等功能按钮
|
||||
class CircularButton(QPushButton):
|
||||
@ -12,8 +13,8 @@ class CircularButton(QPushButton):
|
||||
self.setFixedSize(41, 41)
|
||||
|
||||
# 加载背景图片
|
||||
self.normal_pixmap = QPixmap(":/icons/images/圆形按钮背景1.png") # 正常状态图片 需要修改为实际的路径
|
||||
self.hover_pixmap = QPixmap(":/icons/images/圆形按钮背景2.png") # hover状态图片 需要修改为实际的路径
|
||||
self.normal_pixmap = QPixmap(ImagePaths.ROUND_BTN_BG1) # 正常状态图片 需要修改为实际的路径
|
||||
self.hover_pixmap = QPixmap(ImagePaths.ROUND_BTN_BG2) # hover状态图片 需要修改为实际的路径
|
||||
|
||||
# 确保图片加载成功(可选:添加错误处理)
|
||||
if self.normal_pixmap.isNull():
|
||||
@ -25,6 +26,9 @@ class CircularButton(QPushButton):
|
||||
self.is_hover = False
|
||||
self.normal_text_color = QColor(6, 224, 239)
|
||||
self.hover_text_color = QColor(3, 20, 100)
|
||||
|
||||
# 设置按钮手势
|
||||
self.setCursor(Qt.PointingHandCursor)
|
||||
|
||||
# 去除默认样式
|
||||
self.setStyleSheet("background: transparent; border: none;")
|
||||
|
||||
Reference in New Issue
Block a user