小编Sco*_*ion的帖子

如何在没有 QT 应用程序的情况下使用 QTimer

我想在我的常规课程中使用 QTimer(没有 QT 应用程序,而是从 QTimer 派生)。但是当我尝试这个时:

标题:

#include <qtimer.h>
QTimer* m_timer;
public slots:
    void UpdateClock();
Run Code Online (Sandbox Code Playgroud)

来源:

    m_timer = new QTimer(this);
    QObject::connect(m_timer, SIGNAL(timeout()), this, SLOT(UpdateClock()));
    m_timer->start(1000);

void MyClass::UpdateClock()
{
    int i = 0;
}
Run Code Online (Sandbox Code Playgroud)

计时器永远不会跳转到 UpdateClock 方法!你知道为什么以及我如何解决这个问题吗?

谢谢!

c++ qt timer

0
推荐指数
1
解决办法
2297
查看次数

标签 统计

c++ ×1

qt ×1

timer ×1