//样式基本格式
QComboBox{
font-family: "Microsoft YaHei";//字体类型
font-size: 25px;//字体大小,像素
color: #bdc8e2//字体颜色
background-color:rgba(r,g,b,a);//值transparent为透明
}
//设置字体样式
font-family: "Microsoft YaHei";//字体类型
font-size: 25px;//字体大小,像素
font-style: italic;//字体斜体样式,mormal不斜体
font-weight:bold;//字体加粗样式,mormal不加粗
color: #bdc8e2//字体颜色
font: bold italic 18px "Microsoft YaHei";//顺序要求:style weight size family 或者 weight style size family
//文字位置
Spacing:5px;//选择框和文字之间的距离(水平)
padding-left: 10px;距离左边边界的距离(包括选择框)
padding-top: 10px;距离顶边边界的距离(包括选择框)
padding-right: 10px;距离右边边界的距离(包括选择框)
padding-bottom: 10px;距离底边边界的距离(包括选择框)
//边框样式
border-style: solid;//边框样式,实线:solid ;虚线:dashed; 点线:dotted;
不显示(默认):none;
border-width: 2px;
border-color: red;
border:2px,solid red;//同时设置,固定顺序
//某一条边框(其他三个边框: right,bottom,left)
border-top-style:solid;
border-top-width:2px;
border-top-color:red;
border-top: 2px,solid red;//同时设置,固定顺序
//圆角
border-top-left-radius:20px;//左上角弧度
border-top-right-radius:20px;//右上角弧度
border-bottom-left-radius:20px;//左下角弧度
border-bottom-right-radius:20px;//右下角弧度
bordet-radius:20px;//同时设置4个角的弧度
//背景样式
background-color:rgba(r,g,b,a);//值transparent为透明
background-image:url(".png");//背景图片
background-repeat:no-repeat;//在x轴重复:repeat-x; 在y轴重复:repeat-y
background-position:left center;//图片显示位置:left,right,center,top,bottom;
background: url(".png") no-repeat left center #2e3648;//顺序任意
//动态样式
//鼠标悬浮
QComboBox:hover{
color:
}
//下拉列表显示出来时的样式
QComboBox:on{
color:
}
//下拉框按钮可编辑输入文字时的样式:会覆盖掉hover,on等样式
QComboBox:editable{
color:
}
//下拉图标
//下拉图标属于下拉框按钮的一个子控件drop-down,而drop-down中又包含down-arrow子控件
QComboBox::drop-down{
widget:28px;
height:22px;
border: 1px solid red;
subcontrol-position:center top;// 子控件drop-down的位置
subcontrol-origin:padding;// 子控件drop-down的对齐方式(前提:在QComboBox按钮中设置padding值,哪怕值为0,否则不生效)
//圆角设置和其他控件一样
border-top-left-radius:6px;
border-radius:6px;
//背景图片
image:url(../png);//设置唯一自适应不重复的图片
background-image:url(./png);//需要手动调节repeat,position的属性值;
}
QComboBox::drop-arrow{
color:
}
//下拉列表里的颜色
QComboBox QAbstractltemView {
Selection-background-color:red;// Selection-选中的item
}
具体操作可以使用::down-arrow和:hover配合使用实现
发布了104 篇原创文章 ·
获赞 22 ·
访问量 4万+