QLabel内容设置有透明度的字体颜色

QPalette overPalette;   //走过的步骤
QColor color(219, 226, 241);    //默认透明度为1.0
overPalette.setColor(QPalette::WindowText, color);
QPalette normalPalette; //正常的步骤
color.setAlphaF(0.3);   //设置透明度为0.3
normalPalette.setColor(QPalette::WindowText, color);
ui.lable_FR->setPalette(normalPalette);

Warning: Some styles do not use the palette for all drawing, for instance, if they make use of native theme engines. This is the case for both the Windows XP, Windows Vista, and the Mac OS X styles.
Style sheets let you perform all kinds of customizations that are difficult or impossible to perform using QPalette alone
所以尽量使用设置样式表的方法

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值