Qt Creator - How to set tooltip background color different from widget?

I am working on a GUI and am having a problem. If I set a button, shortcut, or other widget to have a background color, the tooltip for that widget also accepts the same background color. I tried to edit the stylesheet specifically for the hint and set a different background color, but it does not work. I also tried to edit the palette for the widget, but changing the color scheme for the background of the tooltip or text does not work either. Is there any other way I can do this? I would like to have consistency between all my tips.

Thanks!

+4
source share
1 answer

You can do something similar to style QToolTip in general.

 QToolTip { color: #fff; background-color: #000; border: none; } 

If you need the QToolTips style specifically, based on their parent widget, you can use the following syntax:

 ParentWidgetName QToolTip { color: #333; background-color: #1c1c1c; border: none; } 

Reading this will help you further.

+4
source

All Articles