QT 自定义进度条(显示网络质量)

1 篇文章 0 订阅
1 篇文章 0 订阅

在网上找了很多样式,没有类似的,自己实现了一下,纯qss实现,方便使用。

很多时候需要检测网络质量,此时需要类似进度调的样式来显示,qss如下:

最上面的:

QProgressBar{
	border:1px solid #0000ff;
	height:30;
	background:transparent;
	text-align:center;
	color:rgb(255,0,0);
 	border-radius:10px;
}


QProgressBar::chunk{
	border-radius:5px;    
	border:1px solid #63d389;
	background-color:#63d389;
	width:8px;
	height:20px;
	margin:0.5px;
	margin-top:2px;
}

下面红色的:

QProgressBar{
	border:none;
	height:30;
	background:transparent;
	text-align:center;
	color:transparent;
 	border-radius:10px;
}


QProgressBar::chunk{
	border-radius:0px;    
	background-color:#ff0000;
	width:8px;
	height:20px;
	margin:0.5px;
	margin-top:2px;
}

最后是绿色的:

QProgressBar{
	border:none;
	height:30;
	background:transparent;
	text-align:center;
	color:transparent;
 	border-radius:10px;
}


QProgressBar::chunk{
	border-radius:0px;    
	border:1px solid #63d389;
	background-color:#63d389;
	width:8px;
	height:20px;
	margin:0.5px;
	margin-top:2px;
}

 

其实都差不多,主要就是chunk的设置,希望对各位初学者受用。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值