【问题标题】:QPropertyAnimation modifying intervalQPropertyAnimation 修改间隔
【发布时间】:2015-04-18 11:34:17
【问题描述】:

我正在使用 QPropertyAnimation 对象以下列方式移动一些控件:

    QPropertyAnimation* animation = new QPropertyAnimation(message_, "pos");
    animation->setDuration(2000);
    animation->setStartValue(current_pos);
    animation->setEndValue(new_pos); 
    animation->setEasingCurve(QEasingCurve::Linear);
    animation->start(QAbstractAnimation::DeleteWhenStopped);

    asl::checkedConnect(animation, SIGNAL(finished()), this, SLOT(slotScrollingFinished()));

对象通过每隔几毫秒执行一次并修改 pos 属性的值来工作 AFAIK,直到持续时间到期并达到最终值。

我想知道是否有办法修改内部 QPropertyAnimation 对象的间隔计时器,以更改它在 2 秒内访问 pos 属性的次数。

我在文档中看不到任何内容。

【问题讨论】:

    标签: c++ qt4.7 qpropertyanimation


    【解决方案1】:

    你可以这样做:

    #include <qt/src/corelib/animation/qabstractanimation_p.h>
    
    QUnifiedTimer::instance()->setTimingInterval(new_interval);
    

    【讨论】:

    • 对于较新的版本,[VersionDir]\QtCore\private\qabstractanimation_p.h 是包含。
    猜你喜欢
    • 2021-04-11
    • 2022-11-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-25
    • 2021-07-02
    • 2010-10-31
    • 1970-01-01
    相关资源
    最近更新 更多