-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQSS.py
126 lines (106 loc) · 3.52 KB
/
QSS.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
def qss_button_checkable_with_color(color="#1991D3"):
return f"""
QPushButton {{
background: {color};
color: white;
font-weight: bold;
border: 2px solid {color};
border-radius: 5px;
margin: 0px
}}
QPushButton:pressed {{
background: #666666;
color: {color};
font-weight: bold;
border: 2px solid {color};
border-radius: 5px;
margin: 0px
}}
QPushButton:checked {{
background-color: white;
color: {color};
border: 2px solid {color};
font-weight: bold;
border-radius: 5px;
margin: 0px
}}
"""
def qss_slider_with_color(color="#1991D3"):
return f"""
/*horizontal :水平QSlider*/
QSlider::groove:horizontal {{
border: 0px solid #bbb;
}}
/*1.滑动过的槽设计参数*/
QSlider::sub-page:horizontal {{
/*槽颜色*/
background: {color};
/*外环区域倒圆角度*/
border-radius: 2px;
/*上遮住区域高度*/
margin-top:5px;
/*下遮住区域高度*/
margin-bottom:5px;
/*width在这里无效,不写即可*/
}}
/*2.未滑动过的槽设计参数*/
QSlider::add-page:horizontal {{
/*槽颜色*/
background: rgb(255,255, 255);
/*外环大小0px就是不显示,默认也是0*/
border: 0px solid #777;
/*外环区域倒圆角度*/
border-radius: 2px;
/*上遮住区域高度*/
margin-top:7px;
/*下遮住区域高度*/
margin-bottom:7px;
}}
/*3.平时滑动的滑块设计参数*/
QSlider::handle:horizontal {{
/*滑块颜色*/
background: #616161;
/*滑块的宽度*/
width: 5px;
/*滑块外环为1px,再加颜色*/
border: 1px solid #616161;
/*滑块外环倒圆角度*/
border-radius: 2px;
/*上遮住区域高度*/
margin-top:2px;
/*下遮住区域高度*/
margin-bottom:2px;
}}
/*4.手动拉动时显示的滑块设计参数*/
QSlider::handle:horizontal:hover {{
/*滑块颜色*/
background: black;
/*滑块的宽度*/
width: 10px;
/*滑块外环为1px,再加颜色*/
border: 1px solid black;
/*滑块外环倒圆角度*/
border-radius: 5px;
/*上遮住区域高度*/
margin-top:0px;
/*下遮住区域高度*/
margin-bottom:0px;
}}
"""
qss_button_normal = """
QPushButton {
background-color: white;
color: #7f0020;
border: 2px solid #7f0020;
border-radius: 5px;
font-weight: bold;
margin: 0px
}
QPushButton:pressed {
background: #7f0020;
color: white;
border: 2px solid #7f0020;
border-radius: 5px;
margin: 0px
}
"""