[PyQt] Can DockWidgets be docked onto anything else except MainWindows?

Hans-Peter Jansen hpj at urpla.net
Fri Feb 3 00:02:56 GMT 2012


On Thursday 02 February 2012, 08:55:44 Andreas Pakulat wrote:
> On 01.02.12 17:37:53, JPolk wrote:
> > Can DockWidgets be docked onto anything else except MainWindows ?
> >
> > Supposed you have either a layout or a widget that's "mid-page" in
> > a window and want to dock/undock from that layout/widget and not
> > the MainWindow...

A really, really evil idea creepes up my mind: has somebody tried to 
embed a QMainWindow into something else?!?

> > Doesn't look to be possible,...Can anyone confirm this?
>
> You can, but that requires writing a layout-manager similar to the
> one used in QMainWindow (which is not public API so cannot simply be
> used).
>
> So there's no 'out of the box' way to dock QDockWidgets into normal
> QWidgets, but if you put in enough effort you can do that.

Start digging into Qt's QMainWindow code. It might be easier, then it 
appears to be? Converting sane C++ code to Python is pretty straight 
forward.

Pete


More information about the PyQt mailing list