PDA

View Full Version : QTimer problem



rajeshs
1st September 2008, 06:05
hi,

I am using QTimer in my code, i created QTimer object and connectecd timeout signal to one slot. I am giving 5 millisec timeout for timer. but that slot is not calling after timeout.
Any specific way to use the timer?

My code is:


m_pTimer = new QTimer();
connect(m_pTimer, SIGNAL(timeout()), this, SLOT(TimerNotification()));

in buttonClick function:

m_pTimer->start(2000);

tingxx
1st September 2008, 06:43
When you call connect , they will return a bool value, you can see the value is "true"
and , does your TimerNotification() is defined under
public slots
or
private slots

rajeshs
1st September 2008, 07:56
connect returning true, TimerNotification() function is private slot. And in command window "QObject::startTimer: QTimer can only be used with threads started with QThread:" this message is printing. i am not using any QThread in my code.

jpn
13th September 2008, 15:33
Probably either the required Q(Core)Application instance is missing or you're using non-Qt threading mechanisms.