[PySide] tooltip background colour

Frank Rueter | OHUfx frank at ohufx.com
Tue Nov 19 21:16:38 CET 2013


Thanks Matthew,

I realised I am setting a style sheet on that particular widget for 
other reasons, which is what interfered with the palette.

Cheers,
frank

On 20/11/13 06:22, Matthew Woehlke wrote:
> On 2013-11-19 02:50, Frank Rueter | OHUfx wrote:
>> Hi all,
>>
>> I have a few custom widget with tooltips, one of which has such a dark
>> background when run in context of it's host application that it's
>> unreadable.
>> What is the best way to control a tooltip's window/background color?
>> I'm getting a bit lost amongst color roles and groups :/
> Try setting the application palette (QApplication::setPalette) before
> creating any widgets.
>
> Also...
>
>> palette = w.palette()
>> palette.setColor(QtGui.QPalette.ColorGroup.Inactive,
>>        QtGui.QPalette.ColorRole.ToolTipBase,
>>        QtGui.QColor(255,0,0))
> ...try setting the color in the Active group instead or in addition. (I
> think tool tips use active, at least if their parent is active. Maybe
> always... active vs. inactive handling isn't necessarily as well handled
> as it should be.)
>




More information about the PySide mailing list