[PySide] inherited values that contribute to widgets position
Frank Rueter | OHUfx
frank at ohufx.com
Tue Jun 19 07:38:50 CEST 2012
I don't think the animation is the actual problem here but rather
getting the actual widget's position. the animation just makes it
obvious that widget.pos() is hot the true position of the widget, as it
seems to get offset by parents' frame widths and other stuff (at least
that's what it looks like).
So in other words, I'm just after a 100% reliable way to get a widget's
position on screen no matter what layout/parent widget it is part of.
Sorry for not posting an example snippet, will try to extract a light
weight bit a bit later if required.
On 19/06/12 5:30 PM, Srini Kommoori wrote:
> Frank, Pls disregard the previous info then.
> I tried doing my own animation but gave up after playing around with
> QGraphicsView as it has in-built animation controls.
> While trying to do my own custom animation, QPainterPath.cubicTo was
> very useful in getting bezier curve implementation for smooth
> animations. If you are not using this, it might be useful (
> http://goo.gl/0qlBG - PySide docs to QtGui.QPainterPath.cubicTo)
> All the best.
> On Mon, Jun 18, 2012 at 9:14 PM, Frank Rueter | OHUfx <frank at ohufx.com
> <mailto:frank at ohufx.com>> wrote:
> 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.
>> 2. If you are trying to get resizable scene, you may want to
>> use resizeEvent of QtGui.QGraphicsView and adjust your
>> 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.
>> 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
>> 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?
>> PySide mailing list
>> PySide at qt-project.org <mailto:PySide at qt-project.org>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PySide