跳转至

ui/components/animation.cpp

Implementation file for ICFAbstractAnimation to enable MOC processing. More...

Namespaces

Name
cf
cf::ui
cf::ui::components

Detailed Description

Implementation file for ICFAbstractAnimation to enable MOC processing.

This file exists to trigger Qt's Meta-Object Compiler (MOC) for the ICFAbstractAnimation class which uses Q_OBJECT.

Source code

#include "animation.h"

namespace cf::ui::components {

// =============================================================================
// Protected Methods
// =============================================================================

void ICFAbstractAnimation::setTargetFps(float fps) {
    if (fps > 0.0f) {
        targetFps_ = fps;
    }
}

int ICFAbstractAnimation::calculateInterval() const {
    return static_cast<int>(1000.0f / targetFps_);
}

// =============================================================================
// Constructor / Destructor
// =============================================================================

ICFAbstractAnimation::ICFAbstractAnimation(QObject* parent) : QObject(parent) {
    driven_internal_timer = new QTimer(this);
    // Connect timer timeout to tick slot for driving animation updates
    connect(driven_internal_timer, &QTimer::timeout, this, [this]() {
        if (m_state == State::Running) {
            tick(calculateInterval());
        }
    });
}

} // namespace cf::ui::components

Updated on 2026-03-09 at 10:14:01 +0000