Important: Please read the Qt Code of Conduct -

QDockWidget border setting not working as expected

  • Hello,

    I have a QMainWindow in which I have added a QDockWidget. In that QDockWidget there is another widget which is styled using QStyleSheet; among others, border, colors etc have been adjusted. When the QDockWidget is docked, I want it to have no border whatsoever (in addition to the border of the internal widget.

    As you can see in the screenshot, my internal widget has rounded borders in a distinct color. What I am trying is to get rid of the thin grey border around the entire docked QDockWidget.


    I have tried this

    QDockWidget {
      border: 5px solid red;

    to see if the border changes at all, but it does not. When setting the border like this, it only seems to have an effect when the QDockWidget is undocked. Which is exactly the opposite from what is stated in the Qt documentation.
    My expection was that

    QDockWidget {
      border: none;

    would deliver exactly what I am looking for.

    I also cannot use the

    QDockWidget > QWidget{
      border: none;

    method, because my internal widget already has a style that I don't want to change. And this has zero effect on the border that I am concerned about.

    Any ideas, how to solve this?

    I'm on Ubuntu 17.10 btw.


Log in to reply