[PySide] inherited values that contribute to widgets position

Frank Rueter | OHUfx frank at ohufx.com
Tue Jun 19 06:14:03 CEST 2012


Hi Srini,

thanks for the details but I'm not using QGraphicsView.
This is a custom Widget with a stacked layout, that slides the old 
widgets out of frame and the new ones in.
I'm thinking something like this might be what I need to collect and add 
to the widgets' position to get their true positional values (so the 
animation won't stutter):
self.style().pixelMetric( QStyle.PM_DefaultFrameWidth )





On 19/06/12 4:08 PM, Srini Kommoori wrote:
> 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 
> <mailto: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 <mailto: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/20120619/d1804ec9/attachment.html>


More information about the PySide mailing list