4 MINDS

4MINDS Gestão de Conhecimento

Treefrog tasks, timer


Para criar tarefas usando o treefrog framework basta estender a class TApplicationScheduler

Exemplo:

myscheduler.h

#ifndef EMAILSCHEDULER_H
#define EMAILSCHEDULER_H

#include <QSqlDatabase>
#include <TGlobal>
#include <QObject>
#include <TApplicationScheduler>


class T_HELPER_EXPORT MyScheduler : public TApplicationScheduler
{
    Q_OBJECT
public:
    MyScheduler(QObject *parent = nullptr);
    ~MyScheduler();


protected:
    void job();
signals:

};

#endif // EMAILSCHEDULER_H



myscheduler.cpp

#include "myscheduler.h"
MyScheduler::MyScheduler(QObject *parent) : TApplicationScheduler(parent)
{

}
MyScheduler::~MyScheduler()
{
}
void EmailScheduler::job(){
    tDebug() << "execute your job";
}


Para iniciar. O timer vai ser executado a cada 2 segundos.

    MyScheduler *scheduler = new MyScheduler(0);
	
    int msec = 2000;
    scheduler->start(time);