https://stackoverflow.com/questions/13308341/qcombobox-abstractitemviewitem
第一步:
If you replace the default delegate by a QStyledItemDelegate, your style sheet should work:
QStyledItemDelegate* itemDelegate = new QStyledItemDelegate();
combo->setItemDelegate(itemDelegate);
第二步:编辑样式表
QComboBox{
font:normal bold 20px;
color:rgb(201, 215, 52);
}
QComboBox QAbstractItemView::item:selected {
color: rgb(86, 212, 21);
background-color: #327cc0;
}
编译查看效果~
亲测有效~