[PySide] sliding widgets into position

Tibold Kandrai kandraitibold at gmail.com
Thu Apr 26 08:53:10 CEST 2012


Try to subclass QDockWidget. You will have to set it's geometry
manually. Also if you want the widgets to pop up above the centralWidget
than don't add the dock widgets to any layout. Simply add them with the
main window as their parent, and raise them when you show them.
Using this technique I managed to implement auto hiding widgets like in
Visual Studio. It's not trivial, but it's possible.
Actually if you don't need any of the QDockWIdget's functionality you
can do the same with a QFrame as well. Same logic, override it's
geometry, and don't add them to the grid layout. Adding the widgets to
the grid layout will always push the central widget.


On 2012-04-26 08:42, Frank Rueter | OHUfx wrote:
> Hi,
> end of day for me and my brain has gone numb, so I'm probably missing 
> the obvious:
> I'm trying to create a widget with three areas: top, middle and bottom 
> (using QFrames as place holders for now).
> The middle frame is meant to be visible from the start containing some 
> text and other widgets, when the button is pushed, the top frame is 
> meant to slide down into view and the bottom frame is meant to slide up 
> into view, so that I'm left with a controllable vertical arrangements of 
> those three frames.
> Here is my ugly attempt so far:
> http://pastebin.com/index/bNJ9zeUm
> Things do move but I can't control the start and end positions properly 
> and the GridLayout adjusts itself when showing the extra frames, so that 
> the middle frame jumps. I have no idea how to set the size hints etc. to 
> define the start and end positions of the sliding QFrames generically 
> and avoid the jumping middle frame (might have to go with an alternative 
> approach to QGridLayout?!).
> Any help would be greatly appreciated.
> Frank
> _______________________________________________
> PySide mailing list
> PySide at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/pyside

Tibold Kandrai,
CEO @ Dotz Team I/S,
Software developer, consultant

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 552 bytes
Desc: OpenPGP digital signature
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20120426/612ad3d0/attachment.sig>

More information about the PySide mailing list