Drag and drop QDockWidget to QTabWidget
I have a QMainWindow with several docked QDockWidgets and a QTabWidget as the central widget of the QMainWindow. The docking/undocking and re-arranging of the dockable widgets works without a problem.
I want to add functionality to drag and drop a QDockWidget to the QTabWidget, adding the QDockWidget as a new tab to the QTabWidget and removing the source QDockWidget.
The QMainWindow/QDockWidget drag and drop implementation seems to different from the default drag and drop implementation described in "http://qt-project.org/doc/qt-4.8/dnd.html":http://qt-project.org/doc/qt-4.8/dnd.html.
I am able to drag and drop a QDockWidget to the QTabWidget using QDrag->exec() etc., but the QMainWindow/QDockWidget docking is not functional during QDrag->exec().
What are my options to implement the desired drag and drop behavior?
I partly solved this issue without using drag and drop (QDrag).
From the QMainWindow I install an event filter on all the QDockWidgets and monitor if they are "dropped" on the QTabWidget. By only monitoring the events, always pass through the events to the QMainWindow::eventFilter(), the QMainWindow/QDockWidget docking keeps functional.
When a QDockWidget is dropped on the QTabWidget, a new tab is created with the QDockWidget's content and the QDockWidget is removed.
A nice feature would be to highlight the QTabWidget when a QDockWidget is dragged over. Has anybody an idea how to accomplish this?
I still need to figure out how to drag from the QTabWidget to the dock widget area.