×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Apr 2011
    Posts
    22

    QNetworkReply Problem

    hi friends i have to make an Network Request (get or post) . the url is as follows

    http://maps.google.com/maps/geo?q=hanifa&output=csv

    if u copy the url and paste it in the browser, you get an reply .... now my goal is to get the same reply from an Qt application . i wrote the following coding

    but i am not getting the correct response. Any one who has Networking knowledge please try it, say where i am wrong and post the corrected code please

    void MainWindow:n_pushButton_clicked()
    {
    QNetworkAccessManager *nam = new QNetworkAccessManager(this);
    connect(nam,SIGNAL(finished(QNetworkReply*)),this,SLOT(replyFinished(QNetworkReply*)));

    QNetworkReply *reply = nam->get(QNetworkRequest(QUrl("http://maps.google.com/maps/geo?q=hanifa&output=csv")));

    ui->textEdit->setText(reply->readAll());

    qDebug()<<reply->readAll();
    }
    void MainWindow::replyFinished(QNetworkReply *reply)
    {
    QString data = reply->readAll();
    qDebug()<<data;
    }

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,699

    Re: QNetworkReply Problem

    When a question is full Qt, does not contain a single line of Symbian C++ code, you may want to post it to the Qt boards directly.

  3. #3
    Super Contributor
    Join Date
    Mar 2009
    Posts
    1,024

    Re: QNetworkReply Problem

    Hi!
    Except the following lines which are useless:
    ui->textEdit->setText(reply->readAll());
    qDebug()<<reply->readAll();

    The rest of the code is okay and it has to work.
    I even tried myself your code and it works fine for me.

Similar Threads

  1. QNetworkReply undefined reference?
    By loell in forum [Archived] Qt SDKs and Tools
    Replies: 4
    Last Post: 2010-11-14, 14:47
  2. Replies: 3
    Last Post: 2010-09-28, 18:43
  3. QDataStream and QNetworkReply
    By Fillinger in forum Qt
    Replies: 1
    Last Post: 2010-08-23, 12:54
  4. QNetworkReply::ConnectionRefusedError
    By NishaElsa in forum Qt
    Replies: 3
    Last Post: 2010-03-05, 14:11

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×