c++ - Compare QTime and QTimer values -
i call function after x seconds , after y seconds etc.. number of seconds wait before calling function stored in qtime
i thought launching timer , when value of qtimer has value of 1 of qtime, call function, dont' know @ how ..
here idea in "pseudo-code" :
qtime time1(0, 0, 10); // 00:00:10 qtime time2(0, 0, 15); // 00:00:15 // init qtimer if (qtimer.value == time1.value) function1(); if (qtimer.value == time2.value) function2();
how can ?
thanks help
the easiest way use 2 qtimer
objects, each interval respective function.
another option single timer fires @ rate of lowest common denominator, in case 5 seconds, , call each function @ appropriate count. i.e. function1 every second timeout, function2 every third timeout.
another option calculate time until next event , start timer interval.
Comments
Post a Comment