Qt常用样式表-下拉框QComboBox

下拉框QComboBox

QComboBox {

border: 1px solid #CCCCCC;

padding: 1px 1px 1px 3px;

height:32px;

width:85px;

background:white;

color:#666666;

font-size:12px;

text-align:center;

}

QComboBox:hover{

border-radius:2px;

border:1px solid #4589FF;

}

/* 下拉后,整个下拉窗体样式 */

QComboBox QAbstractItemView {

outline: 0px solid gray;

border: 1px solid lightgray;

color: #000000;

background-color: white;

selection-background-color: #EEEEEE;

width:120px;

}

/* 下拉后,整个下拉窗体每项的样式 */

QComboBox QAbstractItemView::item {

height: 26px; /* 项的高度(需设置pComboBox->setView(new QListView()); */

}

/* 下拉后,整个下拉窗体越过每项的样式 */

QComboBox QAbstractItemView::item:hover {

color: #000000;

background-color: #EEEEEE;

}

/* 下拉后,整个下拉窗体被选择的每项的样式 */

QComboBox QAbstractItemView::item:selected {

color: #000000;

background-color: #EEEEEE;

}

/* 下拉框样式 */

QComboBox::drop-down {

subcontrol-origin: padding;

subcontrol-position: top right;

width: 15px;

border-left-width: 0px;

border-left-color: darkgray;

border-left-style: solid;

border-top-right-radius: 3px;

border-bottom-right-radius: 3px;

}

/* 下拉箭头样式 */

QComboBox::down-arrow {

width: 15px;

background: transparent;

padding: 0px 0px 0px 0px;

image:url(/image/down.png);

}

/* 点击下拉箭头 */

QComboBox::down-arrow:on {

image:url(/image/down.png);

}

该篇参考了网上相关资料,修改及整合而来。

你可能感兴趣的:(QT,qss,前端,qt)