开发者

Qt 4.6.2 - QPropertyAnimation not works

开发者 https://www.devze.com 2022-12-26 04:18 出处:网络
I have a problem. I use a QPropertyAnimation to move a QLabel but not works. void TitleChannel::changeChannel(float angle){

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 QPropertyAnima开发者_开发知识库tion(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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消