views:

303

answers:

1

Hi guy, I have a problem. I use a QPropertyAnimation to move a QLabel but not works.

void TitleChannel::changeChannel(float angle){
   int channel=(int)(angle/60);

   QPropertyAnimation *animation = new QPropertyAnimation(label, "geometry");
            animation->setDuration(10000);
            animation->setStartValue(QRect(0, 0, 360, 200));
            animation->setEndValue(QRect(0, 240, 360, 200));
            animation->setEasingCurve(QEasingCurve::InOutElastic);
   animation->start();
}

"label" is a Qlabel pointer that is a parameter of constructor. I also use the property "pos" but not works. The "label" start into QRect(0, 0, 360, 200) but not move into QRect(0, 240, 360, 200) any help? Thanks

A: 

It works well on desktop. Have you tried declaring QPropertyAnimation *animation; in the header file and initialize it on constructor then use it on your function there?

Because regardless of the platform the animation should work, I am using QPropertyAnimation on a Nokia 5800 as well.

milot