Is testNetwork() declared as a slot? Does the class you declare it in contain the Q_OBJECT macro? Please build your application with console support turned on (CONFIG+=console), run the application from command line (or some other way where you have access to the console output) and check whether Qt issues any warning about signal-slot connections.
Hey Wysota,
Thanks for that valuable comment, I looked at the command
line output and it says ( as you must have expected )
"No Such Slot className::SLOTname()"
I checked that I have declared it under private slots:
Is there anything else I should make sure ?
thank you
skp
What is the exact message you get? Could you also show us the header of the class containing the slot?
Following is the code Snippet where the SIGNAL SLOT is connected ::
ftp = new QFtp(this);
connect(ftp, SIGNAL(commandFinished(int, bool)), this, SLOT(ftpCommandFinished(int, bool)));
connect(ftp, SIGNAL(dataTransferProgress(qint64, qint64)), this, SLOT(updateProgressBar(qint64, qint64)));
QMessageBox::information(this, tr("FTP"), tr("Trouble Connecting to the Server. \nPlease try later."));
ftp->connectToHost("192.168.36.251");
timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(testNetwork()));
timer->setSingleShot(1);
timer->start(2000);
progressDialog->setLabelText(tr("Connecting to the Host"));
progressDialog->exec();
the exact error Message is ::
QObject::connect: No such slot projectDC::testNetwork()
the header file contains ::
private slots:
void ftpCommandFinished ( int, bool );
void updateProgressBar( qint64, qint64 );
void cancelDownload();
void testNetwork();
Anything else ?
The whole class header, please. Does it contain the Q_OBJECT macro?
Yes it totally does and the two signals above in the code(ftpCommandFinished & updateProgressBar) work very fine without introducing the
QTimer business.
class projectDC : public QDialog
{
Q_OBJECT
public:
QSize sizeHint() const;
projectDC(QWidget *parent = 0);
private slots:
void ftpCommandFinished ( int, bool );
void updateProgressBar( qint64, qint64 );
void cancelDownload();
void testNetwork();
private:
QTimer *timer;
QFtp *ftp;
protected:
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void closeEvent(QCloseEvent *event);
};
Did you rerun qmake and make sure the moc_xxx.cpp file got updated?
Bookmarks