February 9, 2012

shoyeb shoyeb
Lab Rat
99 posts

[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.

 Signature 

There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code.

6 replies

February 9, 2012

koahnig koahnig
Gene Splicer
2905 posts

Did you see already this example? [developer.qt.nokia.com] It is a good starter.

February 9, 2012

KA51O KA51O
Hobby Entomologist
478 posts

This wiki page [doc.qt.nokia.com] about signals and slots is a good start.

February 10, 2012

shoyeb shoyeb
Lab Rat
99 posts

@koahnig thnx 4 dat example, i will try dat.
@KA51O i have read dat.

 Signature 

There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code.

February 10, 2012

xfreax xfreax
Lab Rat
1 posts

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.

February 10, 2012

kinjalp kinjalp
Lab Rat
6 posts

  1. class Sleeper : public QThread
  2. {
  3. public:
  4.     static void usleep(unsigned long usecs){QThread::usleep(usecs);}
  5.     static void msleep(unsigned long msecs){QThread::msleep(msecs);}
  6.     static void sleep(unsigned long secs){QThread::sleep(secs);}
  7. };
  8.  
  9.  
  10. class SleeperThread : public QThread
  11. {
  12. public:
  13.     static void msleep(unsigned long msecs)
  14.     {
  15.         QThread::msleep(msecs);
  16.     }
  17. };

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]

February 11, 2012

shoyeb shoyeb
Lab Rat
99 posts

kinjalp and xfreax thanx 4 ur reply, i will surely try this and let u know..

 Signature 

There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code.

 
  ‹‹ [Solved]Gateway and QProcess      How to get the bitmap from an Qimage ››

You must log in to post a reply. Not a member yet? Register here!