hi i have class with function that run according to QTimer
(run every 30ms for example )
class testclass
{
public slots:
void DoSomthing();
}
testclass::testclass()
{
QTimer *timer = new QTimer();
connect(timer , SIGNAL(timeout()) , this , SLOT(DoSomthing());
timer->start(30);
}
but i want my DoSomthing()
function to run in separate thread , that's mean make DoSomthing()
function in separate thread and control the function using timer (run my function in thread every some time).
class testclass
{
public slots:
void DoSomthing();
}
testclass::testclass()
{
QThread thread = new QThread ();
connect(thread , SIGNAL(started()) , this , SLOT(DoSomthing());
QTimer *timer = new QTimer();
connect(???, SIGNAL(?????) , ????, SLOT(?????); // how i can continue this code
timer->start(30);
}
how i can do it ?