0

I had an idea I have no clue on how to implement. I'm working with Qt and I'ld like to have a system of tabs that allows me to use tabs in the same way one can use QDockWidgets, that is: with QDockWidgets one can pick a widget and use it floating around the monitor or he can dock it in a QMainWindow in any of the four sides. Well I would like to have such attribute with a QTabWidget! So suppose I have two QTabWidgets in front of me. With the proposed idea, I would be capable to drag and drop a tab (with its widget) from one QTabWidget to another or even simply undock it from its original QTabWidget and start using it independently as another QTabWidget with one tab.

Well I couldn't find a way to use QTabWidget this way "naturally"; it seems Qt doesn't provide such possibility with its pack of widget classes. So does anybody knows any project open to the public containing a class able to do such thing? Or how could I implement such a new class myself? (I don't know for example how could I make the drag and drop effect from a QTabBar since even if setMovable is set to true, still isn't possible to make the tab go away from area of the QTabBar.

Any help will be appreciated.

Momergil
  • 2,213
  • 5
  • 29
  • 59

1 Answers1

2

QDockWidgets already provide possibility to be tabbed. You can check Dock Widgets Qt sample project in Main Windows section. Screen of the just launched sample app: enter image description here

Screen of the tabbed doc widgets: enter image description here

Check this answer for implementation details.

Community
  • 1
  • 1
Max Go
  • 2,092
  • 1
  • 16
  • 26
  • first, thanks for the answer, but actually QDockWidgets don't do what I want as I sad: the mechanism of forming a QTabBar when dragging and dropping only works with QDockWidgets relative to a QMainWindow's "dockable area", not between the QDockWidgets themselves (i.e. if I drag and drop one floating QDockWidget into another, they don't merge in a QTabWidget thing as they do when I drag an drop it over another QDockWidget already docked in a QMainWindow). So although it does half the work, it still isn't what I want. – Momergil Sep 21 '15 at 17:15