#include "mypushbutton.h"
#include
#include
//#include
#include
MyPushbutton::MyPushbutton(QWidget *parent)
: QPushButton{parent}
{
}
void MyPushbutton::moveDown()
{
//qdebug测试槽函数lambda已经成立,动画出了问题
qDebug()<<"动画"<new QPropertyAnimation(this,"geometry",this);
animation->setStartValue(this->geometry());
animation->setEndValue(QRect(this->x(),(this->y()+10),this->width(),this->height()));
animation->setDuration(100);
animation->state();
}
还有就是在 animation->state(QAbstractAnimation::DeleteWhenStopped);给start加上这个结束后删除对象的内容后报错:
mypushbutton.cpp:25:22: Too many arguments to function call, expected 0, have 1
qabstractanimation.h:54:11: 'state' declared here
望采纳!!点击该回答右侧的“采纳”按钮即可采纳!!我现在写给你