Can I override / fix a dock widget's position while it is being dragged?

  • I have a dock widget which switches between horizontal and vertical layouts depending on where it is docked (basically, it's a container for toolbars). Since Qt doesn't know about this logic and makes calculations based on the last known layout, sometimes it prevented me from docking the widget where I want on smaller screens - which I solved by switching it to an "orientation-neutral" layout (which adds a linebreak between each pair of toolbars) as soon as I get topLevelChanged(true) signal.

    All of this works great, but, unfortunately, changing widget's size while it is being dragged can cause it to jump very far away from mouse cursor (e.g. if you undock a horizontal toolbar block by dragging it by the right part of its titlebar). I tried fixing it by calling move() or setGeometry() on the dock widget after changing its layout, but it does nothing. Is there any way to fix it? (i.e. make it jump back to cursor)

Log in to reply

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