PDA

View Full Version : QDockWidget locations



elcuco
3rd August 2007, 15:37
I am trying to convice a layout of 3 dockbars to be placed in a very specific way, and I am missing something.

I want to put the 3 docks on the borders of the window, and the 2 on the sides to be streched from the top to the bottom, and the 3rd on the middle between them.

What I can achieve is only that the bottom dock is spanned over the bottom of the window.

In the attached image the left is what I get, and rigth is what i want (the dock is floating for the screen shot). I saw that FullMetelCoder made this on edyuk, but I failed to find the exact code.

jacek
4th August 2007, 02:36
Experiment a bit with Dock Widgets -> Bottom Left Corner and Dock Widgets -> Bottom Right Corner menus.

A small hint: . (http://doc.trolltech.com/4.3/qmainwindow.html#setCorner)

elcuco
29th January 2008, 15:55
Even with the risk of sounding too stupid...

"I don't get it"

My code looks like:

setDockOptions( QMainWindow::ForceTabbedDocks | QMainWindow::VerticalTabs | QMainWindow::AnimatedDocks );
setCorner( Qt::TopLeftCorner, Qt::TopDockWidgetArea );
setCorner( Qt::TopRightCorner, Qt::TopDockWidgetArea );
setCorner( Qt::BottomLeftCorner, Qt::BottomDockWidgetArea );
setCorner( Qt::BottomRightCorner, Qt::BottomDockWidgetArea );

tabifyDockWidget( dockBuild, dockOutputs_ );
tabifyDockWidget( dockBuild, dockVariables );
tabifyDockWidget( dockBuild, dockOtherVariables );
tabifyDockWidget( dockBuild, dockFindInFiles );
tabifyDockWidget( dockFiles, dockClasses );
tabifyDockWidget( dockCallsStack, dockRegisters );

All tabs are already docked into the main window (they have been set non float docks in the designer).

I read the hints, but it seems I need more help. Sorry :(

wysota
29th January 2008, 16:12
So shouldn't the bottom left corner be associated with the left dock area and bottom right one with the right dock area instead of being associated with the bottom dock area?

elcuco
29th January 2008, 19:33
Is this what you mean? Not working here:



setCorner( Qt::TopLeftCorner, Qt::LeftDockWidgetArea );
setCorner( Qt::TopRightCorner, Qt::RightDockWidgetArea );
setCorner( Qt::BottomLeftCorner, Qt::BottomDockWidgetArea );
setCorner( Qt::BottomRightCorner, Qt::BottomDockWidgetArea );

addDockWidget( Qt::BottomDockWidgetArea, dockBuild );
addDockWidget( Qt::BottomDockWidgetArea, dockOutputs );
addDockWidget( Qt::BottomDockWidgetArea, dockVariables );
addDockWidget( Qt::BottomDockWidgetArea, dockOtherVariables );
addDockWidget( Qt::BottomDockWidgetArea, dockFindInFiles );
addDockWidget( Qt::LeftDockWidgetArea , dockFiles );
addDockWidget( Qt::LeftDockWidgetArea , dockClasses );
addDockWidget( Qt::RightDockWidgetArea , dockCallsStack );
addDockWidget( Qt::RightDockWidgetArea , dockRegisters );

tabifyDockWidget( dockBuild, dockOutputs );
tabifyDockWidget( dockBuild, dockVariables );
tabifyDockWidget( dockBuild, dockOtherVariables );
tabifyDockWidget( dockBuild, dockFindInFiles );
tabifyDockWidget( dockFiles, dockClasses );
tabifyDockWidget( dockCallsStack, dockRegisters );

wysota
29th January 2008, 20:02
Hmm... I meant:

setCorner( Qt::TopLeftCorner, Qt::LeftDockWidgetArea );
setCorner( Qt::TopRightCorner, Qt::RightDockWidgetArea );
setCorner( Qt::BottomLeftCorner, Qt::LeftDockWidgetArea );
setCorner( Qt::BottomRightCorner, Qt::RightDockWidgetArea );

elcuco
30th January 2008, 11:44
I don't understand how, but it works. Thanks :(

wysota
30th January 2008, 22:00
The bottom left corner is to be occupied by the left dock location and not the bottom location, etc. This way the left dock spans the corner and not the bottom one.