cyclic
2nd September 2009, 08:40
hi,
im trying to use a thread to do some background work. It takes a bunch of messages and checks the status of each until it has a "finished" status.
messagestatusthread.h
class MessageStatusThread : public QThread
{
public:
MessageStatusThread(QList<Message*> *messages);
void run();
private:
QList<Message*> *m_messages;
QMultiMap<QString, Address*> *unfinishedMesasgeStatusMap;
QString* buildXml();
void parseXml(QString data);
public slots:
void messageStatusFinished(QString);
};
messagestatusthread.cpp run method
void MessageStatusThread::run()
{
while(!unfinishedMesasgeStatusMap->isEmpty()) {
CommunicationFacade *communication = new CommunicationFacade();
connect(communication, SIGNAL(communicationFinished(QString)), this, SLOT(messageStatusFinished(QString)));
communication->sendRequest(buildXml());
sleep(30);
}
}
I'm using the CommunicationFacade in other parts of the program but not in a separate thread and there it works.
I get Object::connect: No such slot QThread::messageStatusFinished(QString) in messagestatusthread.cpp:34 when I run the program.
The messageStatusFinished(QString) slot is implemented in messagestatusthread.cpp.
Can somebody point out what I'm doing wrong?
Thanks
im trying to use a thread to do some background work. It takes a bunch of messages and checks the status of each until it has a "finished" status.
messagestatusthread.h
class MessageStatusThread : public QThread
{
public:
MessageStatusThread(QList<Message*> *messages);
void run();
private:
QList<Message*> *m_messages;
QMultiMap<QString, Address*> *unfinishedMesasgeStatusMap;
QString* buildXml();
void parseXml(QString data);
public slots:
void messageStatusFinished(QString);
};
messagestatusthread.cpp run method
void MessageStatusThread::run()
{
while(!unfinishedMesasgeStatusMap->isEmpty()) {
CommunicationFacade *communication = new CommunicationFacade();
connect(communication, SIGNAL(communicationFinished(QString)), this, SLOT(messageStatusFinished(QString)));
communication->sendRequest(buildXml());
sleep(30);
}
}
I'm using the CommunicationFacade in other parts of the program but not in a separate thread and there it works.
I get Object::connect: No such slot QThread::messageStatusFinished(QString) in messagestatusthread.cpp:34 when I run the program.
The messageStatusFinished(QString) slot is implemented in messagestatusthread.cpp.
Can somebody point out what I'm doing wrong?
Thanks