QComboBox {
border: 1px solid gray;
border-radius: 3px;
padding: 1px 18px 1px 3px;
color: #000;
font: normal normal 15px "Microsoft YaHei";
background: transparent;
}
QComboBox QAbstractItemView {
outline: 0px solid gray;
border: 1px solid yellow;
color: green;
background-color: red;
selection-background-color: lightgreen;
}
QComboBox QAbstractItemView::item {
height: 50px;
}
QComboBox QAbstractItemView::item:hover {
color: #FFFFFF;
background-color: lightgreen;
}
QComboBox QAbstractItemView::item:selected {
color: #FFFFFF;
background-color: lightgreen;
}
QComboBox QAbstractScrollArea QScrollBar:vertical {
width: 10px;
background-color: #d0d2d4;
}
QComboBox QAbstractScrollArea QScrollBar::handle:vertical {
border-radius: 5px;
background: rgb(160,160,160);
}
QComboBox QAbstractScrollArea QScrollBar::handle:vertical:hover {
background: rgb(90, 91, 93);
}
QComboBox:editable {
background: green;
}
QComboBox:!editable {
background: blue;
}
QComboBox:editable:on {
background: green;
}
QComboBox:!editable:on {
background: blue;
}
QComboBox::drop-down:editable {
background: lightblue;
}
QComboBox::drop-down:editable:on {
background: lightgreen;
}
QComboBox::drop-down:!editable {
background: lightblue;
}
QComboBox::drop-down:!editable:on {
background: lightgreen;
}
QComboBox:on {
}
QComboBox::drop-down {
subcontrol-origin: padding;
subcontrol-position: top right;
width: 15px;
border-left-width: 1px;
border-left-color: darkgray;
border-left-style: solid;
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
}
QComboBox::drop-down:hover {
background: yellow;
}
QComboBox::down-arrow { width: 15px; background: transparent; padding: 0px 0px 0px 0px; image: url(:/images/combobox_arrow_down.png); } QComboBox::down-arrow:on { image: url(:/images/combobox_arrow_up.png); }
注意:
QComboBox* pComboBox = new QComboBox(this);
pComboBox->setView(new QListView()); //下拉列表项高才能生效