QT样式表各类控件操作

一、QLabel

1、背景颜色与倒圆角:

background-color:#4872BC;
border-radius:12px

label控件效果;

2、字体颜色:

color: #B1B1B1;

字体颜色改变效果;

3、直接设置字体:

font: 12pt "Arial Narrow";//设置为pt的格式大小

font-size:24px;//设置为像素点格式的字体大小

 二、进度条——QSlider

/* 需要先设置groove,水平滑动条*/
QSlider#horizontalSlider::groove:horizontal {
    border: none;
    height: 6px;
    border-radius: 3px;
    background: lightgray;
}
QSlider#horizontalSlider::handle:horizontal {
    border: none;
    margin: -5px 0px; /* 上下边距和左右边距*/
    width: 16px;
    height: 16px;
    border-radius: 8px;
    background: #0655C5;

}
/*划过部分*/
QSlider#horizontalSlider::sub-page:horizontal {
    background: #0655C5;
    height: 4px;
    border-radius: 3px;
}
/*未划过部分*/
QSlider#horizontalSlider::add-page:horizontal {
    background: #071B45;
    height: 4px;
    border-radius: 3px;
}

.ui的效果图;

 进度条命名名称;

 进度条运行后拉动效果;

 三、QCeckBox(利用背景图片,可做成按钮切换的样式)

QCheckBox::indicator {
	width: 57px; height: 28px; 
}
QCheckBox::indicator:unchecked{
	background:url(:/sepsis_image/Button_off.png);
}
QCheckBox::indicator:checked{
	background:url(:/sepsis_image/Button_on.png);
}

.ui的效果图;

 点击之后;

 四、QPushButton:

(1)

QPushButton{
	background-color: #4872BC;
	color: #FFFFFF;
	border-radius:12px
}

/*按下*/
QPushButton:pressed{
	background-color: #1148C1;
	color: #6BDCFB;
	border-radius:12px
}

未按下时;

按下后; 

(2)

border-image: url(:/sepsis_image/RedRound.png);/*插入红色圆圈图片*/
color:#FFFFFF;
font-size:16px;
background:transparent;/*背景透明*/

  • 7
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值