How to remove drop shadow from QToolTip

1.5k Views Asked by At

I want to modify the style of all the tool tip windows in my application.

As an example, this QSS : (you can try it in the QtDesigner application)

QToolTip
{
    border-radius: 10px;
    border-style: solid;
    border-width: 2px;
    border-color: red;
}

Give this result :

enter image description here

My problem is to remove the drop shadow effect, and more specifically the white corner here :

enter image description here

I know this can be done by changing the windows flags, but is there any way to change this globally, I mean to set the correct flags somewhere and then all the application use this for displaying tool tip ?

Changing the flags would need to filter all "ToolTip" events on all widgets to provide a custom QToolTip class. This is a lot of work for a big application (about 50 *.ui forms).

1

There are 1 best solutions below

1
On

You could try setting the background-clip property:

QToolTip
{
    background-clip: border;
    border-radius: 10px;
    border-style: solid;
    border-width: 2px;
    border-color: red;
}

Also a QToolTip holds a QLabel to display the actual text. You could try targeting that explicitly with QToolTip QLabel { border: ...; } and make the actual QToolTip background transparent.