#这里MainWindow为实例化出的窗体名(实例名)
qss_style = '''
#pushButton_1,#pushButton_2,#pushButton_3,#pushButton_4,#pushButton_5,#pushButton_6{
background-color:grey;
border-radius:20px;
}
.QPushButton:hover{
background-color:blue;
}
#MainWindow{
border-image:url(../Joint_Drive/splash.png);
}
#tableWidget{
background-color:cyan;
}
'''
MainWindow.setStyleSheet(qss_style)
QSS common selector (QSS Selector):
1. Wild Selector: *
2. Type Selector: the QPushButton matching instances of the class and its subclasses (forward plus one . Does not include instances of subclasses)
3. ID selector (ObjectName Selector): # pushButton_1 ObjectName is matched controls pushButton_1
* 4 mix (using the same set of QSS):. # aaa, # bbb, # ccc use commas to
QSS pseudo-state (colon + + {} operating only on the last selector):
#pushButton_1:hover{background-color:red}
QSS global context, labels, buttons, background settings:
#Window_Object_Name {border-image: url ( ...)}
of course also possible to use background-image, but is filled with border-image effects, background pixel taken only in accordance with the execution area displays! !
pushButton_1 {#
background-Image: URL (...);
}
QSS controls fillet:
#pushButton_1{
border-radius:30px;
}
[Common CSS selectors introduction]
- Tag selector: Tag {xxx: xxx;}
- ID selector: #ID {xxx: xxx; yyy: yyy;}
- Child element selector: # AAA # bbb {xxx: xxx;}
- class selector: .class {xxx: xxx;}