Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Help designing "drag-out" tabs?
I have a working app that presents a Main Window whose central widget is a QTabSet with a variable number of "panels" (QWidgets with various different layouts and contents).
I would like to upgrade this as follows: the user can click-down on a Tab and drag that panel out of the tab set, where it will become an independent window (I suppose, become a QDialog, but that's not the issue). Or, the user can grab the border of an independent panel and drop it on the Tab Bar and it will again become a Tab in the Tab Set.
Modern browsers like Firefox and Chrome have just this behavior. But I am at a loss where to start researching this in Qt. At a general level, how would you approach this starting from QTabSet populated with QWidgets? General suggestions welcome. Perhaps someone has done this kind of thing already? Pointers to example code that does similar things would be VERY helpful!
I would subclass QTabBar and set this custom version on the QTabWidget you use as central widget.
For the drag and drop part you can start "here":http://qt-project.org/doc/qt-4.8/dnd.html
Hope it helps
I am making good progress on this, have mastered much of drag'n'drop, also found a valuable tip via StackOverflow: see the "delayed encoding example":http://qt-project.org/doc/qt-4.8/draganddrop-delayedencoding.html for a clever hack to get control during a drop.
Note that you might get into trouble on OS X, the delay does not happen see this "report":https://bugreports.qt-project.org/browse/QTBUG-31301
Thanks for the pointer, that surely saved me some work. Another fine hack down the drain...
I learned a lot about drag-and-drop and have now put everything I know into the following blog: http://thispageintentionally.blogspot.com/2014/01/ts-drag-and-drop-architecture-for.html
Unfortunately the answer appears to be, what I want to do is not possible.