PDA

View Full Version : QDockArea in Qt4...



TemporalBeing
7th April 2009, 19:41
I want to create a dockable area in my Qt4-based application. I am aware of Q3DockArea, and would rather not use that, but it does seem to provide what I want - though I want to work with QDockWidgets instead.

I realize QMainWindow handles dockable widgets itself, but I don't want to have yet another main window in my application - I already have one, and this would be embedding one inside another - I want this as part of the central widget.

Background:

The application uses a QMainWindow for its main interface. The central widget of that main window is a QStackWidget. Each QWidget that is added to the QStackWidget is providing some specific functionality, one of which is the primary screen for the application. I'd really like to have the primary screen be something that is more user configurable (think like how KDevelop and Visual Studios IDEs) where the user can rearrange the view - place things where they want them, move them around, snap things together and move them as a block, etc.

I know the dock area won't provide everything (e.g. the snap together and move as a block), but I'd rather not implement anything more than I have to - I don't have the time to spare.

I know I can implement something using the QGridLayout; but a Qt4 QDockArea would probably do best. (Think of it as the central widget.)

I'm sure other people out there would like to do something similar. Is there anything that already exists that does this?

talk2amulya
7th April 2009, 20:04
havent u seen the dock widgets example in Qt demo..isnt that what u need precisely?

TemporalBeing
7th April 2009, 21:24
Just to be sure - I just looked at it, and no - that's not what I need; namely because it has a central widget, which I don't want; similar though.

What I want to be able to rearrange widgets. Similar to moving a dock widget from one side of the screen to the other, only I want to be able to have it take up the central area too.

So widgets X, Y, Z could be ordered in any of the following from left to right across the layout:
Y X Z
X Y Z
Z Y X
Z X Y
X Z Y
Y Z X

that's quite different than what QMainWindow provides, which is what that demo shows - QDockWidgets inside a QMainWindow; which is explicitly not what I want.

I think I can achieve this with a QDockAreaLayout - and just make it the whole layout; but there is none in Qt4.

talk2amulya
7th April 2009, 21:56
you do have the option of creating that layout then..and when u r done, be kind enough to share it with the rest of the world ;)

aamer4yu
8th April 2009, 05:24
I guess you will need to add drag drop functionality.
You could look into designer code how they do it. I guess thats what you want ...