首页 > 其他 > 详细

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

时间:2015-07-22 20:17:49      阅读:643      评论:0      收藏:0      [点我收藏+]

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

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

原文:http://www.cnblogs.com/pamilty/p/4668124.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!