下拉後設置如下屬性方法:
1、下拉框的背景色和當前默認選中的顏色(一般爲當前框中的第一個值)
QComboBox QAbstractItemView {
background-color: rgb(255,255,255); /* 整個下拉窗體的背景色 */
selection-background-color: rgb(366,244,203); /* 整個下拉窗體被選中項的背景色 */
2、越過每一項的顏色,(注意中間hover少一個:號 )
之前版本:
QComboBox QAbstractItemView::item::hover {
color: #FFFFFF; /*下拉框背景色*/
background-color: red; /* 越過每項的背景色 */
}
現在版本:
QComboBox QAbstractItemView::item:hover {
color: #FFFFFF; /*下拉框背景色*/
background-color: red; /* 越過每項的背景色 */
}
3、之前co'mbobox默認刷新,現在需要加如下屬性,要不然會出現combobox當前裏面的值不能立馬刷新
QComboBox{border:1px solid gray; border-radius: 5px;padding-left:10px}