Take the 2-minute tour ×

I am working on a GUI and I've run into a problem. If I set a button, label, or other widget to have a background color, the tooltip for that widget also takes the same background color. I tried editing the style sheet for the tooltip specifically and setting a different background color but it doesn't work. I also tried editing the palette for the widget but changing the color scheme for the tooltip background or text doesn't work either. Is there another way I can do this? I'd like to have consistency between all my tooltips.


share|improve this question

1 Answer 1

up vote 1 down vote accepted

You can do something like this to style a QToolTip in general.

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

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

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

Reading this will help you further.

share|improve this answer
I tried adding that code to the stylesheet and changed it to the background color I want, but it still doesn't change the tooltip background when I run my application. Am I missing something? Where should I be adding that code? –  lomokat Dec 4 '12 at 3:26
I got it! Just had to set it in my actual code instead of going into the widget stylesheet! –  lomokat Dec 4 '12 at 3:36
You can either have a separate file with all your css contents and apply it to the whole application at run time. Search Stackoverflow for related questions, you will find a way how to do it. Of course you have Qt documentation as well to refer further. –  AmazingSixty Dec 4 '12 at 5:38

Your Answer


