Important: Please read the Qt Code of Conduct -

The doc says "null central widget is not supported", but it's actually possible

  • Hello,

    for my project I need a docking system behaving like Unity3D: no central widget, everything is a DockWindow and can be layout freely by the user.

    I noticed this behaviour was possible by simply never setting a central widget in the MainWindow (not even a placeholder, because it would create a useless area with a sizer), and enabling nested docks.

    However, the doc says:
    "Note: Creating a main window without a central widget is not supported. You must have a central widget even if it is just a placeholder."

    I also noticed there is a takeCentralWidget() method since 5.2, that internally calls d->layout->setCentralWidget(0);, and the comments on setCentralWidget() don't mentions that the parameter should never be null.

    Is there an error in the documentation?

  • Lifetime Qt Champion


    That might be something that have changed between Qt versions. You should go to the bug report system and see if there's already something about it. If not please consider opening a bug for the documentation to be updated on that aspect.