下拉后设置如下属性方法:
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}