0
点赞
收藏
分享

微信扫一扫

QComboBox stylesheet样式表

Sikj_6590 2022-08-16 阅读 84


效果如下:

QComboBox stylesheet样式表_线框

QComboBox {
border-radius: 3px;
padding: 1px 10px 1px 5px;
border: 1px solid #636363;
}

QComboBox::drop-down {
subcontrol-origin: padding;
subcontrol-position: top right;
width: 15px;
border-left-width: 1px;
border-left-style: solid;
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
border-left-color: #636363;
}

QComboBox::down-arrow,QDateEdit::down-arrow {
image: url(:/icons/array_down.png);
}

/*去掉item的虚线框*/
QComboBox QAbstractItemView {
outline: 0px;
}

QListView::item:selected {
color: #F0F0F0;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #4D4D4D, stop:1 #292929);
}

QListView::item:hover {
color: #F0F0F0;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #636363, stop:1 #575757);
}

QListView::item {
padding: 5px;
margin: 0px;
height:30px;
}

QComboBox还得设置一下,否则Item的高度不会变。

QStyledItemDelegate *itemDelegate = new QStyledItemDelegate();
ui->comboBox->setItemDelegate(itemDelegate);

 

举报

相关推荐

0 条评论