PDA

View Full Version : DockWidgets with no centralWidget



drave
16th February 2011, 11:08
I'm looking to create an app who's front end would be 3 windows that fill the main window. These 3 can be dragged arround inside mainwindow, and can be dragged out to become floating windows but those inside mainwindow must allways fill all the space in it.
That all sounds just like 3 dockwidgets, but I havent been able to find a way to give them the attributes to do that? There is allways a space somewhere between them, that they do not autofill. I'm thinking some sort of layout as well but...

How would i do that?

thanks

thibs
1st February 2017, 12:38
You can remove the centralWidget by using
setCentralWidget(0); in your MainWindow constructor

d_stranz
1st February 2017, 19:09
You can remove the centralWidget

@thibs: That almost certainly won't work (as I have tried to explain in your other posts around this same topic of QMainWindow and QDockWidget). If you use QMainWindow, you are expected to follow the Qt protocol for using that class. It means dock widgets are added to the QMainWindow, not as standalone objects, and you must have a central widget. Otherwise, you will likely get undesirable behavior as QMainWindow tries to deal with an incorrect usage.

@drave: You should look at using QMainWindow with QMdiArea as the central widget. With QMdiArea, you can tile the QMdiSubWindow instances that wrap your child widgets so they cover the entire area as you desire.