Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

use of undeclared identifier 'connect'

me again! :-[

I'm trying to write a simple downloader in qt. it's based on this example: http://www.ggkf.com/qt/qnetworkrequest-to-download-an-image

downloader.cpp:

void Downloader::GetImage( QString _url, QNetworkAccessManager *qnam ) {
    connect( qnam, SIGNAL( finished( QNetworkReply *) ), this, SLOT( replyFinished(   QNetworkReply * ) ) );

    QUrl url = QUrl( _url );
    QNetworkRequest request( url );

    qnam->get( request );
}

but i get the following error:

/Users/name/ssl/downloader.cpp:19: error: use of undeclared identifier 'connect'
connect( qnam, SIGNAL( finished( QNetworkReply *) ), this, SLOT( replyFinished( QNetworkReply * ) ) );

can anyone of you explain me this error? :-)

thanks in advance

like image 275
btzs Avatar asked Nov 12 '13 09:11

btzs


1 Answers

please ensure Downloader does inherit from QObject.

class Downloader : public QObject{

}
like image 111
Ryeeeeee Avatar answered Oct 27 '22 20:10

Ryeeeeee