9tontruck 0 Newbie Poster

Hi guys,

I am having a small problem on using QNetworkAccessManager in QThread. The error message is:
"Object::connect: No such slot QThread::replyFinished(QNetworkrReply*)"

And my code is
header

class SSLReceive : public QThread
{
//Q_OBJECT


public slots:
    void replyFinished(QNetworkReply* net_reply);

protected:
    void run();

private:
    void initialize();
    QNetworkAccessManager* manager;
    QSslConfiguration config;
};

implement

void SSLReceive::replyFinished(QNetworkReply *net_reply)
{
    QByteArray data = net_reply->readAll();
    QString str(data);


    //emit onFinished(net_reply);
}


void SSLReceive::run()
{
    initialize();

    config.setPeerVerifyMode(QSslSocket::VerifyNone);
    QNetworkRequest request;
    string target = IM_url_getData;

    request.setUrl(QUrl(target.c_str()));
    request.setRawHeader("User-Agent", "DK");
    request.setRawHeader("Content-type", "text/plain");
    request.setSslConfiguration(config);
    connect(manager, SIGNAL(finished(QNetworkReply*)),
            this, SLOT(replyFinished(QNetworkReply*))); //<-- error
    manager->get(request);
}

void SSLReceive::initialize()
{
    manager = new QNetworkAccessManager;
    config = QSslConfiguration::defaultConfiguration();
}

I definitly have 'replyFinished(QNetworkrReply*)' in my class which is derived by QThread. I dont know why this happens..
Should I put something else instead of 'this'?

What am I missing? Please help!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.