[SOLVED]How to handle our own signals and slot.
-
Hi,
I want to implement my own signals and slot in my application. But i am confused regarding the emission of signals, i want my signal to be emiited at a specific time. But i dont know how to do this.
Please help me with this.
I am a newbie in Qt. -
Did you see already "this example?":http://developer.qt.nokia.com/doc/qt-4.8/widgets-digitalclock.html It is a good starter.
-
"This wiki page":http://doc.qt.nokia.com/4.7/signalsandslots.html about signals and slots is a good start.
-
-
shoyeb, why dont you create one timer, and when its timeOut() occurs, emit your signal.
Remember that you need to connect the timer's timeOut() to its event handler where you can emit that signal.
-
@
class Sleeper : public QThread
{
public:
static void usleep(unsigned long usecs){QThread::usleep(usecs);}
static void msleep(unsigned long msecs){QThread::msleep(msecs);}
static void sleep(unsigned long secs){QThread::sleep(secs);}
};class SleeperThread : public QThread
{
public:
static void msleep(unsigned long msecs)
{
QThread::msleep(msecs);
}
};
@use before connect function or signal emit Sleeper::sleep(10);
May this will help for giving specific delay for emiting signal... :)
[Edit: Be sure and wrap code in @ tags. Thanks! -mlong]
-
kinjalp and xfreax thanx 4 ur reply, i will surely try this and let u know..