6
votes

I'm trying to style my QDockWidget so that it has a border when docked and when floating.

I tried:

QDockWidget 
{
    border: 5px solid purple;
}

But this only produced a border when floating. When docked, the border just disappeared.

How can I solve this?

1

1 Answers

6
votes

Try

QDockWidget > QWidget {
    border: 5px solid purple;
}

This is the result for the docked state:

enter image description here

This is the result for the undocked state:

enter image description here