WINUSERAPI
UINT_PTR
WINAPI
The SetTimer (
_In_opt_ HWND HWND,
_In_ UINT_PTR nIDEvent,
_In_ UINT uElapse,
_In_opt_ TIMERPROC lpTimerFunc);
CodePudding user response:
Is some, QTime: : start to get a handle, and rewrite TimeEvent handle the handle events regularlyCodePudding user response:
I'm wrong, the year long forgotten, actual it is this:An alternative to using QTimer is to call QObject: : startTimer () for the object and reimplement the QObject: : timerEvent () event handler in your class (which must inherit QObject). The disadvantage is that timerEvent () does not support to high - level the features as single cyber-shot timers or signals.
Another alternative is QBasicTimer. It is typically less cumbersome than using QObject: : startTimer () directly. See Timers for an overview of all three approaches.
Some operating systems limit the number of timers that may be 2; Qt tries to work around these limitations.
See also QBasicTimer QTimerEvent, QObject: : timerEvent (), Timers, Analog Clock Example, and Wiggly Example.
That is to say, you inherit from QObject class, can get through the startTimer on a handle to the timer, the function prototype is int QObject: : startTimer (int interval and Qt: : TimerType TimerType=Qt: : CoarseTimer)
Then you rewrite your class [virtual protected] void QObject: : timerEvent (QTimerEvent * event), in this function can be gained according to the startTimer before the handle to the timer values to deal with timer events respectively, similar to:
Int timerHandle=startTimer (2000);//ms
.
Void MyClass: : timerEvent (QTimerEvent * event) {
If (timerHandle==event - & gt; TimerId ()) {
ProcessThisTimerEvent ();
}
}
CodePudding user response:
QTimer qt's built-in timer classCodePudding user response:
There is a timer class, when I was studying your fog used once,CodePudding user response:
QTimer * mytimer02HintLabel;//in. H fileMytimer02HintLabel=new QTimer (this);
The connect (mytimer02HintLabel, SIGNAL (timeout ()), and this, SLOT (hideLableHint_slot_fun ()));
Mytimer02HintLabel - & gt; Start (5000);
CodePudding user response:
Some QObject provides a startTimer, returns timer Id, and then process in the virtual function l timerEvent timer events