PDA

View Full Version : signals not conecting...



JoZCaVaLLo
31st July 2009, 08:32
Hi Volks,
I'm trying to connect some http signals... obviously, as all good newbies, it doesn't work...

Here is my class declaration


#include <Qt/qfile.h>
#include <QtNetwork/QHttp>
class ciao : public QObject
{
Q_OBJECT

public:
ciao();
~ciao();

void Run();
void tryFinished( int id, bool error );
void tryReadProgress( int id, int total );

private:
QFile myFile;
QHttp *http;
};

And here is what I'm doing in my constructor



http = new QHttp(this);
myFile.setFileName("something.txt");

bool result;
result = connect(http, SIGNAL(requestFinished(int, bool)),
this, SLOT(tryFinished(int, bool)));
result = connect(http, SIGNAL(dataReadProgress(int, int)),
this, SLOT(tryReadProgress(int, int)));


But... result is alway false. It sounds like connect does not recognize my methods to be valid.

Where I'm doing wrong???????

wagmare
31st July 2009, 08:36
is it printing in the console like
Object::connect: No such signal ....
or it giving error while making

nish
31st July 2009, 08:39
you have forgotten the "slots:"


#include <Qt/qfile.h>
#include <QtNetwork/QHttp>
class ciao : public QObject
{
Q_OBJECT

public:
ciao();
~ciao();

void Run();
public slots://LOOK HERE
void tryFinished( int id, bool error );
void tryReadProgress( int id, int total );

private:
QFile myFile;
QHttp *http;
};

everything else is fine