Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make tabs movable in Qt

Tags:

c++

tabs

qt

docking

I want to make an application in Qt where the tabs in the QTabBar can be "undocked" so they will become a floating window, or can be dragged into another QTabBar and "transfer" into that QTabBar. My aim is to let the user completely customize the interface by dragging modules around into each other.

If you have ever used Adobe After Effects CS5, it has the exact effect I'm looking for. It allows you to drag a tab and make it float as it's own window, dock it into another tab page and do a lot more.

So, if anyone could point me in the right direction on how to go about this, or even where I would begin that would be great!

like image 331
Brad Avatar asked Dec 28 '10 06:12

Brad


1 Answers

Take a look to the Qt Main Window Demo it uses QDockWidget rather than QTabBar's. This example should be included the QTDIR/demos/ folder of your Qt installation.

You will see that there are no tabs in the window, but try to drag some dock and drop it over another dock an you will see that a tabbar is created. Also the docks can be floating around the desktop. This behavior is provided by Qt and it can be enabled or disabled with just set some flags for the docks. Check the code for more details.

I hope that this was what you're were looking for.

like image 79
Miguel López Avatar answered Sep 20 '22 05:09

Miguel López