QCombobox组合框的样式

来源:互联网 发布:iphone手机倒计时软件 编辑:程序博客网 时间:2024/05/18 15:08
QComboBox

{

width: 400px;  //整个组合框的宽度 设置后在ui编辑器中即可用看见效果

min-width: 250px;

max-width: 500px;

height: 600px;

border-radius: 3px;//  边框的圆角

border: 12px;

font-size: 12pt;

font-family: 微软雅黑,宋体;

background-repeat: no-repeat;

background-position: center left;

padding-left: 42px;

color: white; //该处的color是,组合框中的编辑框中文本的颜色。---------------------------------------

selection-color: black;

selection-background-color: darkgray;

}


QComboBox::drop-down //组合框右侧的下三角按钮

{

background-color: black; //该下三角按钮的背景色

min-width: 200px; //下三角按钮的最小宽度

}


/*

Descendant SelectorQDialog QPushButtonMatches all instances of QPushButton that are descendants (children, grandchildren, etc.) of aQDialog.下面的形式是一种选择符,因为QComboBox的下拉列表框实际上是一个QListWidget部件,而QListWidget部件又派生自QListView,QListView又派生自QAbstractItemView类。

*/

QComboBox QAbstractItemView

{

height:1000px;//下拉列表框的高度 即item所在的下拉列表区域-------------

border: 12px;

color: red;  //组合框中的item的颜色  //跟QComboBox中的color区分开来-------------------------------------------

selection-color: green;  //鼠标选中该item的颜色

selection-background-color: darkgrey;  //鼠标选中该item的背景色


padding:30px,30px,30px,30px;//此处的效果是 listWidget部件与QCombox中edit编辑框的距离 以及 与 combobox底部的距离

}

QComboBox QAbstractItemView::item

{

height: 100px;

min-height:100px;

}

0 0
原创粉丝点击