[PySide] inherited values that contribute to widgets position

Srini Kommoori vasure at gmail.com
Tue Jun 19 06:09:39 CEST 2012


As you are asking about animation, I am assuming you are
using QtGui.QGraphicsView.

Working with QGraphicsView, I found following few key things related to
size/coordinates.

1. By default QtGui.QGraphicsView aligns the scene to center. So all
resizes are set wrt center. To change the anchoring back to top, use
following.

setAlignment(QtCore.Qt.AlignTop)

2. If you are trying to get resizable scene, you may want to
use resizeEvent of QtGui.QGraphicsView and adjust your widgets/layouts.

3. Have a default screen size so that widget reference starting point is
something you can always control. You could also do relative distances
based on the screen size - but it is some more initialization that you need
to take care of.

Hope above is what you are looking for.

thanks
-Srini

On Mon, Jun 18, 2012 at 4:33 PM, Frank Rueter | OHUfx <frank at ohufx.com>wrote:

> Hi everyone,
>
> I am trying to learn what inherited value may contribute to a widget's
> real screen position.
>
> In my example I have a widget that I am animating out of frame, so I
> need to determine exactly what it's static position is to be able to set
> that as the animation's start value. If I just use QWidget.pos().x() I
> am 5 pixels off. So currently I'm just adding 5 pixels manually, but
> would love to understand where those come from and how to calculate the
> widget's position properly and reliably.
>
> Any ideas anyone?
>
> Cheers,
> frank
> _______________________________________________
> PySide mailing list
> PySide at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/pyside
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20120618/25bbeecc/attachment.html>


More information about the PySide mailing list