开发者

Make tabs movable in Qt

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!


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜