Important: Please read the Qt Code of Conduct -

QDockWidget and QDialog

  • Can I use QDockWidget inside a QDialog? I seed that I can't move a QDockWidget if it is embedded in a QDialog. It works only in QMainWindow.

  • Lifetime Qt Champion

    Hi , Docks seems to want a CentralWidget to dock around so it wants QMainWindow.
    However, I did managed to insert a QMainwindow into a other widget grid layout
    so I could have Docks where I wanted.

    I assume you can do the same for Dialog if you create a new QMainwindow and give dialog as parent and
    insert into a layout. Remember to call setCentralWidget so it has one.
    I cant promise it works for Dialog also but if I can have QMainwindow in a QMainwindow, the odds are good :)

  • I've tried but without a nice end.
    Is QDockWidget officially supported by QDialog or not?
    In other words is this a bug?

  • Lifetime Qt Champion

    Hi, only QMainWindow is supported.
    So if inserted QMainWindow into other widgets
    and its does strange things. It most likely not a bug
    but just not supported.
    So when you inserted QMainWindow into Dialog , what was the issues /didnt work ?

  • Works. I hoped to find a way using only the mouse without to have to write code :)

  • Lifetime Qt Champion

    Well Designer is not so crazy
    about inserting MainWindows into dialogs :)
    You might be able to promote a Widget to QMainwindow but still need some code to set

  • Windows, Linux, Mac: three different behaviours.
    On Linux all is perfect.
    On Mac is not possible to resize the dock (already submit as bug).
    On Windows there the resize button disappear when the dock is out.

Log in to reply