Important: Please read the Qt Code of Conduct -

Adding central toolbar to QMainWindow with QDockWidgets

  • In my app (video editor), I have a bottom Central Widget with QDockWidgets above. Now I would like to have a toolbar at the center of the app (below dockwidgets but above central widget). Qt only allows the 4 QDockWidgetArea (top, bottom, left, right) for toolbar docking. Is there a way to customize this and allow a toolbars to be docked at the center of the app just above central widget ?

    I know I can create a custom toolbar and add it as widget to the layout but then I loose the nice QMainWindow toolbar features (customizing, moving toolbar)

    I want something like this:

    | Main Toolbar                  |
    | Dock Widget 1 | Dock Widget 2 |
    | Central Toolbar               | 
    | Central Widget                | 

    Any help appreciated.

  • Moderators

    Hi and welcome to the forum.

    This isn't directly supported, but you can achieve similar result if you make your central widget another QMainWindow. This has the downside that you can't move the toolbars between the two QMainWindows, unless you manage to reparent them dynamically while dragging (should be possible but I haven't tried it).

Log in to reply