Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can anyone give me same someting to keep in mind while using signals and slots in Qt?

I am learning to program using Qt framework. When I writes some code have signals and slots involved, the events didn't seem to fire and the signals and slots didn't seem to work. It really me make me annoyed. Can you give me some cautions and warnnings about signals and slots in Qt?

slot declarations:

private slots:
            void onFtpCmdFinish(int cmdId, bool error);
            void onRealtimeFtpCmdsDone(bool error);

connection code:

   ftpHandle = new QFtp( this );
   connect(ftpHandle, SIGNAL(commandFinished(int, bool)), this, SLOT(onFtpCmdFinish(int, bool)));

   connect(ftpHandle, SIGNAL(done(bool)), this, SLOT(onRealtimeFtpCmdsDone(bool)));

Thank you in advance!

like image 762
Liu Avatar asked Dec 06 '25 20:12

Liu


1 Answers

In the future, if you ever happen to run into problems with your Qt signals and slots again, the contents of the following blog entry can turn out to be a real life-saver (or at least a very good starting point for your investigations):

http://samdutton.wordpress.com/2008/10/03/debugging-signals-and-slots-in-qt/

It meticulously lists 20 ways to debug/troubleshoot your signals and slots; follow this list and chances are high that you will eventually find out what's wrong.

I hope that helps.

like image 197
Greg S Avatar answered Dec 09 '25 16:12

Greg S



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!