Search code examples
qtqt5qtstylesheetsqdockwidget

Can't set border to QDockWidget from external QSS stylesheet file


I want to add borders to a QDockWidget using an external QSS file.

This is what I have:

QDockWidget without borders

And this is what I want:

enter image description here

I've tried using:

QDockWidget {
    border: 5px solid red;
}

but it doesn't work at all;

If I am using the designer by right clicking on the QDockWidget and choosing Change stylesheet and I use border: 5px solid red; inside the dialog everything works fine. But I want to use an external QSS file.

Is it possible to attach a QSS file to my widget and border it as wanted?


Solution

  • Found the solution:

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

    Good luck!