Qt QToolTip 控件背景的 QSS 设置方法(摘抄)

Qt/C++/CSS: QTooltip stylesheet background colour

Hi there,

I've recently come across a problem developing for the Windows platform, relating to Windows own 'themes'. I have been developing a program with Windows Basic display but upon running the program with a Theme enabled (e.g. Windows Aero), my QTooltips change their background colour, even though the font colour remains correct.

I have linked my stylesheets which work 100% in Basic mode where I declare how to display the QTooltip:
@QToolTip{
color: #8f8;
background-repeat:no-repeat;
background-position:center;
background-color: #222;
}@

The background colour when using a Windows theme simply remains white. I have tried declaring this code within my C++ application, both directly before AND after objects are created to no avail. Using a separate .css file and loading the stylesheet to the parent window also doesn't seem to affect the background-colour. I have been looking around for a solution for some time now (returning to the problem on occasion for the last few months) but have not come across anyone with a similar issue.

Any help would be highly appreciated.

Kind Regards,
Kirennian.


----------------------------------------------------------------------------------------------------------------------------------------------
I try your QSS on Linux with KDE and I think that on KDE is similar situation. I found an "old bug with code":https://bugreports.qt-project.org/browse/QTBUG-2849. On my system when I add to QToolTip QSS
@
border-style: none;
/* border-style: outset; works too */
@
then backgorund-color starts working. Maybe this will help you.

 

link: https://forum.qt.io/topic/24023/qt-c-css-qtooltip-stylesheet-background-colour/2

转载于:https://www.cnblogs.com/pamilty/p/4668124.html

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值