Important: Please read the Qt Code of Conduct -

[SOLVED] QDockWidget issue

  • Hi all,

    I have a main window with a central widget (top right) and 3 QDockWidgets: one is dockable only in the bottom area and causes no trouble, the two others are dockable to the left or right. At startup they are both on the left.

    I've made a quick video to show it better: "QDockWidget problem":

    Let's call these two QDockWidgets QDW1 and QDW2. If I drag QDW2 I can undock it, so far so good.
    When I want to dock it (on the left) I have three options: I can dock it above QDW1, below it (its original position) or kind of "at the same place as QDW1". This last option leads to my QDW2 disappearing, as shown from second 0:15 f the video.

    You'll notice that from second 0:21 I use menu actions to try to un-hide my QDW2 with no success.

    But hiding QDW1 works and now I can show QDW2 back. However, un-hiding QDW1 now (second 0:35) leads to some sort of tab widget appearing, but even this does not seem to work as expected (once I click on a tab, my QDW2 disappears again).

    Is there a way to prevent this "overlapping" of widgets ?


  • Lifetime Qt Champion


    Looks like you might have found a bug. You should have a QTabBar to allow you to select which dock widget you want to see. You can use the setDockNestingEnabled function to disable that.

    You should also go to the "bug reports system": and see if something known, if not please open a new report providing a minimal compilable example that shows the behavior.

  • Thanks !

    In fact nested docks works fine but tabbed docks do not work. In code:
    setDockOptions(QMainWindow::AllowNestedDocks); // OK
    setDockOptions(QMainWindow::AllowTabbedDocks); // KO

    I tried to create a minimal example but guess what, everything works fine there. So it must be something I'm doing wrong in my code ... maybe some size hint or similar not set ...

    I'll try to have a look, in any case I don't need the nested/tabbed feature in my app.


  • Just to confirm, the bad was in my code: once tabbed, the widget can be not visible but still shown in the tabbed widget, I wasn't considering that.

    Not a Qt bug then.


  • Lifetime Qt Champion

    Sorry for the mix between tabbed and nested.

    Glad you found out

    Happy coding !

Log in to reply