Important: Please read the Qt Code of Conduct -

Dockable widget in a widget (not the QMainWindow)?

  • Hi,
    I have an application with a QStackedWidget as central widget. In this stack, one page is divided in two parts:

    • a set of tools with configuration widgets specific to each tool (a little bit like that you find in GIMP),

    • the display widget

    Now, what I wants is that the set of tools acts as a QDockedWidget. That is to say:

    • I must be able to undock it, and have it as floating widget. Then I must be able to move it,

    • I must be able to dock it again in the page, when I drop it close to the borders of the page.

    I have tried to use QDockWidget for this. But I only have the half of my needs. I am not able to dock it again, when it is in floatable state.

    Is it possible with QDockWidget (ar another existing class), or should I implement all from QWidget?

  • Lifetime Qt Champion

    The QMainwindow provides the dock areas so it cant work as a widget.
    However, you can use QMainwindow as a widget and cheat in that way.
    However, its a bit hacky.

  • Thanks a lot. It works. Now I just have to set a style to the Dock widget

Log in to reply