qt样式表界面美化

发布于:2023-01-01 ⋅ 阅读:(539) ⋅ 点赞:(0)

一个完整的界面一般包含窗口样式表(可以指定控件(选择器)伪状态样式表)和控件样式表。

不得不说qt的样式表是真大可以做很漂亮的界面,但是有一点不足的是使用样式表效率有点低,电脑还好说,性能强劲,对于imx6这种孱弱的芯片,使用样式表还是有那么一点点耗时间的。

Login窗口样式表

QPushButton:pressed
{
background-color: rgba(74, 125, 254, 255);
	/*background-color: rgba(95,134,219, 255);/*UI设计给的*/
 	border-style: inset;
 	border-radius: 4px;
	border-width:1px; 
	border-color:grey;
	outline:none;
	/*padding:-1;*/
}
QPushButton:!pressed {
	background-color: white;
	/*background-color: rgba(66,88,136, 255);/*UI设计给的*/
 	border-style: inset;
 	border-radius: 4px;
	border-width:1px; 
	border-color:grey;
	outline:none;
	/*padding:-1;*/
}
QDialog 
{
	border-style:none;
	background-color:white;
}

各控件样式表
ButtonCancel控件

//Login窗口样式表已指定

ButtonEnter控件

//Login窗口样式表已指定

PWD控件

//Login窗口样式表已指定

Username控件

//Login窗口样式表已指定

frame控件

border-style:none;
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0.039548 rgba(1, 248, 40, 255), stop:1 rgba(72, 239, 236, 255))

ButtonClose控件

background:transparent;
border-style:none;
background-image: url(:/file/res/image/键盘关闭.png);

lineEditTitle控件

border-style:none;
color: rgb(255, 255, 255);
background:transparent;

frame_7控件

border-style:none;
background-image: url(:/file/res/image/身份.png);

frame_8控件

border-style:none;
background-image: url(:/file/res/image/密码图标.png);

label控件

color: rgb(0, 0, 0);
background:transparent;

label_2控件

color: rgb(0, 0, 0);
background:transparent;

ui文件效果
在这里插入图片描述
运行效果
在这里插入图片描述

本文含有隐藏内容,请 开通VIP 后查看

网站公告

今日签到

点亮在社区的每一天
去签到