PyQt5基础学习-子控件QSS的设置
设置控件的名字,对控件下面的子控件进行设置QSS
QSSSubControl.py
""" QSS子控件选择器 QComboBox """ from PyQt5.QtWidgets import * import sys class QSSSubControl(QWidget): def __init__(self): super(QSSSubControl, self).__init__() self.setWindowTitle("QSS子控件选择器") combo = QComboBox(self) combo.setObjectName("myComboBox") combo.addItem("Window") combo.addItem("Linux") combo.addItem("Mac OS X") combo.move(50, 50) self.setGeometry(250, 200, 320, 150) if __name__ == "__main__": app = QApplication(sys.argv) form = QSSSubControl() # drop-down: 下拉框的图片设置 qssStyle = """ QComboBox#myComboBox::drop-down { image:url(../picture/F6fhJr.jpg) } """ form.setStyleSheet(qssStyle) form.show() sys.exit(app.exec_())
每天更新pyQt5内容