Docking QDockWidget to main window and on top of other widgets



  • When I create a QDockWidget that floats on top of other widgets, the dock widget is not attached to main window, as a result if the main window moves the dock widget does not move along.

    My overall plan is to create a button to hide/show the dock widget, as it floats on top of other widgets, it will not affect the view of everything else.

    Thanks.


  • Qt Champions 2016

    Hi
    Floating Docks are windows and they are not moved with mainwindow as they might be
    full screen or on another monitor so in most use cases it makes no sense to move with parent.

    Im not sure what your question is, if any ?



  • @mrjj said in Docking QDockWidget to main window and on top of other widgets:

    other monitor so in most use cases it makes no sense to move with p

    I see. I think my question would be how to make a QDockWidget sit on top of other widgets, in its docking mode and undocking mode... Thanks.


  • Qt Champions 2016

    Hi
    Im not sure what sit on top means.
    When in floating mode, its a window and not inside the main app.

    If you want to move the docks if mainwindow is dragged/moved then you need
    to override
    virtual void moveEvent ( QMoveEvent * event )
    (for mainwindow)

    and then manually adjust the docks you think is ok to move.



  • @mrjj

    Sorry about the confusion... Let me try again...

    When I dock a QDockWidget to main window, other widgets in the main window will resize to fit with the QDockWidget so that there is no overlapping. I'd like to let the QDockWidget overlap other widgets (and be on top) so that when it docks, other widgets will not resize. What can I do? Thanks.


  • Qt Champions 2016

    @Pauly
    If i understand you correctly, i do not think its possible.
    http://doc.qt.io/qt-5/qmainwindow.html
    alt text

    It has areas to dock to, so im not sure how it could overlap other widgets already in
    the mainwindow.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.