我试图自定义QCombobox。我创建了这个Combobox。
当我将这个组合框或事件封面悬停在整个组合框上时,我想删除蓝色背景颜色。
这是我的代码:
QComboBox {
text-align: center;
background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #797979, stop:0.48 #696969, stop:0.52 #5e5e5e, stop:1 #4f4f4f);
padding: 2em 2em 2em 3em;
min-width: 8em;
color: #ffffff;
}
QComboBox::hover
{
background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #797979, stop:0.48 #696969, stop:0.52 #5e5e5e, stop:1 #4f4f4f);
}
QComboBox::drop-down {
subcontrol-origin: padding;
subcontrol-position: top right;
width: 20px;
text-align: center;
}
QComboBox::down-arrow {
image: url(:/images/arrows2.png);
}
QComboBox QAbstractItemView {
outline: 0px;
}
QComboBox QAbstractItemView::item
{
padding-left: 2em;
text-align: center;
height: 2em;
background-color: lightgray;
}
QComboBox::down-arrow:on { /* shift the arrow when popup is open */
image: url(:/images/arrows2.png);
}