1717from PyQt5 .QtCore import QStringListModel , QSortFilterProxyModel
1818# ui相关的小组件,非窗口
1919
20- BLUE_BUTTON_QSS = """
20+ GLOBAL_QSS = """
21+ QSpinBox, QLineEdit {
22+ border-width: 2px;
23+ border-radius: 8px;
24+ border-style: solid;
25+ border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 #85b7e3, stop:1 #9ec1db);
26+ border-right-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #85b7e3, stop:1 #9ec1db);
27+ border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #85b7e3, stop:1 #9ec1db);
28+ border-left-color: qlineargradient(spread:pad, x1:1, y1:0, x2:0, y2:0, stop:0 #85b7e3, stop:1 #9ec1db);
29+ background-color: #f4f4f4;
30+ color: #3d3d3d;
31+ }
32+
2133QPushButton {
2234 background-color: #00A2E8;
2335 color: white;
2739 font-size: 16pt;
2840 font-weight: bold;
2941}
42+
43+ QComboBox {
44+ border-width: 2px;
45+ border-radius: 8px;
46+ border-style: solid;
47+ border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 #85b7e3, stop:1 #9ec1db);
48+ border-right-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #85b7e3, stop:1 #9ec1db);
49+ border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #85b7e3, stop:1 #9ec1db);
50+ border-left-color: qlineargradient(spread:pad, x1:1, y1:0, x2:0, y2:0, stop:0 #85b7e3, stop:1 #9ec1db);
51+ background-color: rgba(244,244,244,0);
52+ color: #3d3d3d;
53+ font: 12pt "微软雅黑";
54+ }
55+ QComboBox::drop-down {
56+ width: 26px;
57+ }
58+
59+ QLabel {
60+ font: 12pt "微软雅黑";
61+ }
62+
3063"""
3164
3265
@@ -39,9 +72,7 @@ def _init_round(self):
3972 self .setWindowFlags (Qt .FramelessWindowHint | Qt .Window )
4073
4174 def paintEvent (self , event ):
42- # # 阴影
43- # path = QPainterPath()
44- # path.setFillRule(Qt.WindingFill)
75+ # 阴影
4576
4677 p = QPainter (self )
4778 p .setRenderHint (p .Antialiasing )
@@ -93,6 +124,8 @@ class RoundQWidget(QWidget, RoundMixin):
93124 def __init__ (self , parent = None ):
94125 super ().__init__ (parent )
95126 self ._init_round ()
127+ self .setStyleSheet (GLOBAL_QSS )
128+
96129 def closeEvent (self , event ):
97130 self .closeEvent_ .emit ()
98131 event .accept ()
@@ -102,8 +135,8 @@ def closeEvent(self, event):
102135class RoundQDialog (QDialog , RoundMixin ):
103136 def __init__ (self , parent = None ):
104137 super ().__init__ (parent )
105- self .setStyleSheet (BLUE_BUTTON_QSS )
106138 self ._init_round ()
139+ self .setStyleSheet (GLOBAL_QSS )
107140
108141
109142
0 commit comments