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