【PyQt5-Qt Designer】QComboBox-下拉列表框


知識點:

1、QComboBox下拉列表框的一些常用方法

2、下拉列表框常用信號使用方法

案例:選中下拉框選項時觸發信號

#[str] 表示comboBox中的選擇框內容如A B C D 等
self.comboBox.activated[str].connect(self.BrushPhoto)

定義的BrushPhoto(self) 函數

def BrushPhoto(self, text):
        if text=="A":
            self.graphicsView_5.setStyleSheet("border-image: url(:/brush/photo/brush/A.png);")
            self.lineEdit_58.setText("刷子A")
        elif text=="B":
            self.graphicsView_5.setStyleSheet("border-image: url(:/brush/photo/brush/B.png);")
            self.lineEdit_58.setText("刷子B")
        elif text=="C":
            self.graphicsView_5.setStyleSheet("border-image: url(:/brush/photo/brush/C.png);")
            self.lineEdit_58.setText("刷子C")
        elif text=="D":
            self.graphicsView_5.setStyleSheet("border-image: url(:/brush/photo/brush/D.png);")
            self.lineEdit_58.setText("刷子D")
        elif text=="E":
            self.graphicsView_5.setStyleSheet("border-image: url(:/brush/photo/brush/E.png);")
            self.lineEdit_58.setText("刷子E")
        elif text=="F":
            self.graphicsView_5.setStyleSheet("border-image: url(:/brush/photo/brush/F.png);")
            self.lineEdit_58.setText("刷子F")
BrushPhoto 函數

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM