PDA

View Full Version : Passing argument to slot.



TCB13
22nd February 2012, 18:45
Hello,
I'm trying to pass an argument to a slot triggered by a finished() signal.

My code right now is this:

download.cpp


(...)
connect(&fdmanager, SIGNAL(finished(QNetworkReply*)),SLOT(FileDownload Finished(filechk,QNetworkReply*)));
QNetworkRequest request(QUrl(fileurl.data()));
fdmanager.get(request);
(...)
void download::FileDownloadFinished(QByteArray chksum, QNetworkReply *reply) {
(...)
}


download.h


(...)
public slots:
void FileDownloadFinished(QByteArray chksum, QNetworkReply *reply);
};
(...)


The code compiles without any warnings, but when it run... I get this on the program output:


Object::connect: No such slot download::FileDownloadFinished(filechk,QNetworkRep ly*)


Apparently I'm not passing the arguments correctly... How should I do it?

Thanks in advance. :cool:

Lykurg
22nd February 2012, 19:48
You can't. You have to emit your own signal which matches this signature, or you can have a look at QSignalMapper if it could be used in your case.

TCB13
22nd February 2012, 19:52
You can't. You have to emit your own signal which matches this signature, or you can have a look at QSignalMapper if it could be used in your case.

Thank you for the info. I'll take a look at QSignalMapper.