【QSS样式表 - ③】:QSS常用属性

QSS常用属性

字体样式

在这里插入图片描述
以上也可以直接写成一行:

font: 字体风格 字体粗细 字体大小 字体名称;

QSS示例

新建一个 QMainWindow 窗口程序,拖入两个QLabel控件:

在这里插入图片描述
代码:

#label {
   
	color: red;
	/*字体*/
	font-family: "Microsoft YaHei";
	/*字体加粗*/
	font-weight: bold;
	/*字体尺寸*/
	font-size: 24pt;
	/*字体风格*/
	font-style: italic;
}

#label_2 {
   
	font: italic bold 36pt "宋体";
}

在这里插入图片描述

边框样式

在这里插入图片描述
注意:只要遵守上 右 下 左的原则,都遵循以下规则。(以 border-width为例)

border-width: 2px;				表示四个边框都一样为2px
border-width: 2px 15px;			表示上下为2px,左右为15px
border-width: 2px 10px 2px;		表示上为2px,左右为10px,下为2px

每条边还可以分开设置:

  1. border-width

     border-top-width
     border-right-width
     border-bottom-width
     border-left-width
    
  2. border-style

     border-top-style
     border-right-style
     border-bottom-style
     border-left-style
    
  3. border-radius

     border-top-left-radius
     border-top-right-radius
     border-bottom-left-radius
     border-bottom-right-radius
    

也可以直接写成一行:

border: 边框宽度 风格 边框颜色;

QSS示例

新建一个 QMainWindow 窗口程序,拖入三个QLabel控件:
在这里插入图片描述
代码:

#label 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

街 三 仔

你的鼓励是我创作的最大动力~

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值