我有一个从QVariantAnimation派生的类,我必须在动画完成后运行一个代码。
我尝试过信号finished(),但没有发出:
connect(this, SIGNAL(finished()), this, SLOT(setEndVariables()));是否还有其他意见来查看动画是否停止,或者信号的使用是否错误?
编辑:与代码
LiConfigurableFrameAnimation::LiConfigurableFrameAnimation(QString compId, int dur, LiConfigurableFrame *f)
{
if(dur>0)
this->setDuration(dur);
frame=f;
widget=frame->getComponent(compId);
isRectMode=false;
isImageMode=false;
connect(this, SIGNAL(finished()), this, SLOT(setEndVariables()));
}头文件:
class LiConfigurableFrameAnimation: public QVariantAnimation
{
private slots:
void setEndVariables();
};发布于 2013-08-28 07:00:19
我解决了问题:
我重载函数updateCurrentTime并检查当前时间是否等于持续时间。
updateCurrentTime(int curr)
{
if(curr >= this->duration())....
... https://stackoverflow.com/questions/18383020
复制相似问题