PDA

View Full Version : Having the MainWindow made completely out of docks



kainev
5th June 2016, 10:25
Hi everyone!

I've started developing an application using PyQt (though C++ answers are welcomed!) and I want it to be made entirely of docks so the user can move, undock and generally re-position everything to whatever they want.

I began by not setting a central widget for the MainWindow. This provides the exact functionality I want like so:

11969

However, if you remove all the docks from a particular side, say for example we remove the right side docks, the left side dock/s expand to cover the entire MainWindow meaning it's impossible to redock anything back onto the right dock area:

11970


I've also attempted to set a blank widget with size (0,0) as the central widget, however the user can then separate the docks with the individual splitter handles it creates, leaving unusable space between them like so:

11971

Any help is greatly appreciated!

Cheers,
Kaine

d_stranz
5th June 2016, 21:56
You were almost there. Use a blank QWidget as the central widget, set its background color to be what you desire. You may have to derive from QWidget so you can override the resizeEvent, but you basically want it to resize to be the same size as the central area of your main window. If you don't use Qt Designer to set up a default UI for your app, then you can configure the main window to have no status, tool, or menu bars if that's what you want.