- TTimer is used for repeating the jobs each a little seconds.
- TTimer needs the class for use.
- See the below.
class Test_timer{
RQ_OBJECT("Test_timer") // RQ_OBJECT is macro on ROOT. It allows "Connect" method to available.
public :
Test_timer(){}
~Test_timer(){}
void TimeDone() // Here. TimeDone methods plays a roll as SLOT.
{
printf("hello\n");
}
};
exam_timer()
{
TTimer* timer = new TTimer(); // TTimer is created.
Test_timer* tt; // Class is created for use TTimer. You must set the instance to pointer.
timer->Connect("Timeout()","Test_timer",tt,"TimeDone()"); // Now, Connect between timer and class method.
timer->Start(2000,kFALSE); // First argument is time(ms), eg. 2000 means 2 seconds.
// kFALSE means that it is to repeat. However, kTRUE means that it is only used at first time.
}
--
GunmoRyu - 30 Apr 2009