[Interest] animation problems
Graham Labdon
Graham.Labdon at avalonsciences.com
Tue Nov 26 10:41:48 CET 2013
This is the approach I am now taking
-----Original Message-----
From: interest-bounces+graham.labdon=avalonsciences.com at qt-project.org [mailto:interest-bounces+graham.labdon=avalonsciences.com at qt-project.org] On Behalf Of André Somers
Sent: 26 November 2013 09:25
To: interest at qt-project.org
Subject: Re: [Interest] animation problems
Mitch Curtis schreef op 26-11-2013 9:59:
> On 11/25/2013 03:30 PM, Nurmi J-P wrote:
>> On 25 Nov 2013, at 14:57, Graham Labdon <Graham.Labdon at avalonsciences.com> wrote:
>>
>>> Hi
>>> I am trying to animate the movement of one of my widgets I have a
>>> simple Qt app consists of a main window with a label (done in
>>> QDesigner) The code to move the label is
>>> QPropertyAnimation animation(ui.label,"geometry");
>>> animation.setDuration(10000);
>>> animation.setStartValue(ui.label->rect());
>>> QRect end = QRect(ui.label->rect().x() - 10,ui.label->y() - 10,ui.label->rect().width(),ui.label->rect().height());
>>> animation.setEndValue(end);
>>> animation.start();
>>>
>>> Now this does move the label but it is move instantly whereas I thought that by specifying a duration , this would be how long it took to do the animation.
>>>
>>> I would be grateful if some could explain what I am doing wrong
>> Hi, try allocating the animation on the heap so that it won't get immediately destructed according to the normal C++ scoping rules.
> Perhaps the documentation shouldn't construct it on the stack if
> that's not how it's meant to be used:
>
> http://doc-snapshot.qt-project.org/qt5-stable/animation-overview.html#
> animating-qt-properties
>
> I can see that the person writing that example probably did it in
> main(), but that's not how most people will be using it. Should I
> submit a patch?
I'm not sure if creating on the heap is the usual pattern either. I usually have my animations as members in an object, not created separately on the heap.
André
_______________________________________________
Interest mailing list
Interest at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
More information about the Interest
mailing list