Question

I am trying to format the content of some QToolTip using stylesheets.

Setting a widget's stylesheet to

<h1>Title</h1>Content

produces the expected result, and I can style the tooltip with, for instance

QToolTip { color: red; }

to get red colored text. I am now trying to use the stylesheet for the h1 inside the tooltip, but this produces no effect:

QToolTip h1 { color: blue; }

while setting it directly in the string works:

<h1 style='color: blue'>Title</h1>Content

Is there a way to perform this action with stylesheets? I tried using classes, but without success.

TIA

Was it helpful?

Solution

The selector you trying to use is invalid, you can see a list of Selector Types here.

There is no way to select the <h1> of a QToolTip using style sheets, since it's not a Widget. You have to go for the other way you already pointed out.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top