[PySide] tooltip background colour

Matthew Woehlke matthew.woehlke at kitware.com
Tue Nov 19 18:22:14 CET 2013


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.)

-- 
Matthew




More information about the PySide mailing list