Qthread + Q_object problem
Hi, i'm having some trouble introducing signals on a class that heritates from qthread,the class is this one:
Code:
Q_OBJECT
private:
.
.
.
.
private slots:
.
.
..
and so on
i asign signals on the cpp file
Code:
connect(http, SIGNAL(requestFinished(int, bool)),
this, SLOT(httpRequestFinished(int, bool)));
and after when i compile i get this error:
Code:
./release\tejecutor.o:tejecutor.cpp:(.text+0x1fd2): undefined reference to `TEjecutor::staticMetaObject'
./release\tejecutor.o:tejecutor.cpp:(.text+0x261c): undefined reference to `TEjecutor::staticMetaObject'
./release\comunicacion.o:comunicacion.cpp:(.text+0x23ab): undefined reference to `vtable for TEjecutor'
./release\comunicacion.o:comunicacion.cpp:(.text+0x277b): undefined reference to `vtable for TEjecutor'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [release\Zeus.exe] Error 1
mingw32-make: *** [release] Error 2
Exited with code 2.
Error while building project Zeus
When executing build step 'Make'
If i erase the "Q_Object" it builds perfectly but signals wont work.
What can i do?
Re: Qthread + Q_object problem
seems to me, that you have to clean your total project and remove also the Makefile. Then rebuild your application and all should work fine.
Re: Qthread + Q_object problem
Re: Qthread + Q_object problem
Is there any problem with Threads+Signals from Qhttp??? i cant make it work when it is a Thread, but if i change it to a normal class instead of Thread, it works perfectly, otherwise signals dont arrive to my thread.... :(
Re: Qthread + Q_object problem
The QHttp instance needs to be created in the same thread that is performing the HTTP operation. If you create it outside, and invoke it from within a QRunnable, you won't get your signals.