qt下拉框 QComboBox uses the model/view framework for its popup list and to store its items. By default a QStandardItemModel stores the items and a QListView subclass displays the popuplist.
QComboBox 使用模型/视图框架作为其弹出列表并存储其项目。默认情况下,QStandardItemModel 存储项目,QListView 子类显示弹出列表。
qss 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 QComboBox {     border-radius : 3px ;     color : rgb (0 ,0 ,0 );     border : 1px  solid #c2c2c2 ;;     padding-top : 2px ;     padding-left : 2px ;     background-color : transparent; } QComboBox:disabled  {     color :rgb (160 ,160 ,160 );     background-color : rgba (0 , 0 , 0 , 0.3 ); } QComboBox:on {     color : rgb (0 , 0 , 0 );     padding-top : 4px ;     padding-left : 4px ;     background-color : rgba (0 , 0 , 0 , 0.0 );     border : 1px  solid #c2c2c2 ;     border-radius : 5px ; } QComboBox QAbstractItemView  {     height : 30px ;        font-size : 16px ;     outline : 0px  solid gray;       border : 1px  solid rgb (66 ,66 ,66 );       color : rgb (0 ,0 ,0 );     background-color :rgba (0 , 0 , 0 , 0.0 ); }   QComboBox QAbstractItemView::item {       color : rgb (255 ,255 ,255 );     background-color :  rgba (0 , 0 , 0 , 0.3 ); } QComboBox QAbstractItemView::item:selected  {     color :rgba (75 ,175 ,255 , 1 );        background-color :  rgba (0 , 0 , 0 , 0.0 ); }   QComboBox::drop-down  {     border :none; }   QComboBox::down-arrow  {     image: url (./res/comboboxdown.png ); }   QComboBox::down-arrow:on {     image: url (./res/comboboxdown1.png ); } 
cpp 对话框类构造函数里面调用
1 2 3 4 5 6 ui->comboBox->setView (new  QListView (ui->comboBox));  ui->comboBox->view ()->parentWidget ()->setWindowFlags (Qt::Popup | Qt::FramelessWindowHint| Qt::NoDropShadowWindowHint); ui->comboBox->view ()->parentWidget ()->setAttribute (Qt::WA_TranslucentBackground);