Hi,
I've noticed that the QDockWidget can only actually be docked within a MainWindow. I'd like to be able to have one which docks only within a QFrame. Is this possible, and why exactly does it have this behaviour?
Hi,
I've noticed that the QDockWidget can only actually be docked within a MainWindow. I'd like to be able to have one which docks only within a QFrame. Is this possible, and why exactly does it have this behaviour?
A QMainWindow has the docking infrastructure, a QFrame does not.
So, no you can't use a QDockWidget in the same way in a QFrame as you do in a QMainWindow.
Why do you want dock widgets in a frame?
The problem lies in not being able to nest QMainWindows (assuming I'm not wrong about that). What I have is a mainwindow with different perspectives, switched via checkable toolbar buttons. The perspective change only alters everything below the toolbar, essentially loading almost an entire new part of the software. As a result, it's as if each of these perspectives is its own MainWindow, without its own toolbars. But since I can't just place a MainWindow within another, I use a QFrame.
This problem at hand is actually a bit more complicated, since I want my DockableWidget to reside in another QFrame nested in the one I spoke of above. Essentially, I have something resembling the following:
Everything below the toolbar is within a QFrame. And the right side of the treeview is actually another QFrame. As you can see, in that frame is where I want the QDockWidget to be.
You might need to do some clever hack for dock widget drag and drop.. you can extract the widget from QDockWidget and set it as a child of QFrame..
then on drag event, you can again set the widget as child of QDockWidget.....
it might not be easy,,, but thats what came to my mind![]()
Can you nest a mainwindow? Cuz as far as I know, each time I try it just creates it as a new dialog. Otherwise I wouldn't have a problem. I guess I'll give it another shot...
I can't try it out atm, but I'm pretty shure. Maybe
will help?!Qt Code:
setWindowFlags(Qt::Widget);To copy to clipboard, switch view to plain text mode
Last edited by CeeKey; 1st June 2010 at 15:18.
Polnareff (1st June 2010)
That worked! It was so simple :P Thanks a bunch!
Bookmarks