[PyQt] Position widgets over widgets

Hans-Peter Jansen hpj at urpla.net
Thu Apr 7 14:19:53 BST 2011

On Thursday 07 April 2011, 14:58:30 Mads Ipsen wrote:
> Hi,
> I have attached a simple example where a widget sets up two labels.
> One which is added to the layout of the widget, and one which is not.
> In the paintEvent() of the parent widget I instead position the
> non-layout label using setGeometry to make it appear in the center of
> the parent widget.
> However, the label positioned by this approach is always obscured by
> the widget which was added to the layout. I want it to appear as
> visible, i.e. visible on top of the parent widget.

Create _label2 after _label1, but this is a questionable approach.

Why can't you use something like QStackedLayout?


More information about the PyQt mailing list