combobox包含两个条目,当单击组合框时,列表视图占据组合框的框架。我要在组合框下面的列表视图。样式表如下所示:
QComboBox {
border: 1px solid #8F9EAB;
border-radius: 3px;
font: 16pt "Arial";
min-width: 6em;
color: #1B3067;
background-color: rgb(255, 255, 255);
padding-left:10px;
QComboBox:pressed
border: 1px solid #1562AD;
color: rgb(255, 255, 255);
background-color: #87A6D5;
QComboBox:disabled
border: 1px solid #BFBFBF;
color: #BFBFBF;
background-color: rgb(255, 255, 255);
QComboBox::down-arrow
background-image: url(:/Images/data/img/Images/DOWN_enabled.png);
height: 7px;
width : 13px;
QComboBox::drop-down
subcontrol-position: top right;
width: 40px;
color: white;
border-left-width: 0px;
border-left-color: #8F9EAB;
border-left-style: solid;
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
QComboBox QListView
font: 16pt "Arial";
color: rgb(80, 80, 80);
QComboBox QAbstractItemView::item
border-bottom: 5px solid white; margin:3px;
}
发布于 2018-06-15 07:43:14
Qt样式表无法处理
view()
的位置,您必须创建一个继承自
QComboBox
并覆盖
showPopup()
方法的类,如下所示。
class ComboBox: public QComboBox{
public:
using QComboBox::QComboBox;
public: