Multiple QtimerEvent handling
-
Dear sir,
I have used single Q TimerEvent to call a timer slot continuously in given specific time. but in My application I have to call multiple Q timer events from a single push button .
so please help me for firing of multiple QTimerevent .
and how to kill by using their QTimerId of every Q timer event; -
Dear sir,
I have used single Q TimerEvent to call a timer slot continuously in given specific time. but in My application I have to call multiple Q timer events from a single push button .
so please help me for firing of multiple QTimerevent .
and how to kill by using their QTimerId of every Q timer event;@qt_ankit_developer said in Multiple QtimerEvent handling:
I have used single Q TimerEvent to call a timer slot continuously in given specific time. but in My application I have to call multiple Q timer events from a single push button .
do you create the timer events manually?! o.O
If so, why?? -
Dear sir,
I have used single Q TimerEvent to call a timer slot continuously in given specific time. but in My application I have to call multiple Q timer events from a single push button .
so please help me for firing of multiple QTimerevent .
and how to kill by using their QTimerId of every Q timer event;@qt_ankit_developer
to quote myself:@J.Hilk said in Q timer Event with timer id:
@qt_ankit_developer
even so @sierdzio is correct, a QTimer instance would be easier. Here is how you would do it via QTimerEvent:void myClass::startMyTimerEvent() { if (m_timerId == -1) m_timerId = startTimer(m_Timeout); } void myClass:: stopMyTimerEvent() { if (m_timerId != -1) killTimer(m_timerId); m_timerId = -1; } void myClass::timerEvent(QTimerEvent *event) { if(event->timerId() == m_timerId) { //do Stufff .... callMyFunction(); } }
instead of a single member variable,
m_timerId
use a QVector or QList of ints to store your ID's. -
I feel you should use the QTimer and be happy. You can refer my GIT see the example. timeEvent handling requires good boilerplate code.