I had a solution in pyQt4 to undock-dock a tab from/to a QTabWidget by using QDockWidgets and the code below. After floating a tab, the re-docking was obtained by double clicking the titlebar of the QDockWidget. But it does not work any more in pyQt5 (the double-click does not seem to trigger a topLevelChanged event). Why? How to fix it