Search code examples
qtqdockwidget

How to detect when a QDockWidget is moved out of a QMainWindow?


There is a signal which allows the user to know where a QDockWidget has been moved inside a QMainWindow :

void dockLocationChanged(Qt::DockWidgetArea area)

The problem is that this signal is not fired when a QDockWidget is moved out of the QMainWindow (either by dragging or by double-clicking the dockwidget's title bar).

Is there a way to detect that event, without reimplementing moveEvent()?


Solution

  • There is a floating property exactly for that purpose, and a topLevelChanged signal.