×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Nov 2009
    Posts
    27

    Question QNetwork? How? I'm a Noobie

    Hey all, I need several things, but for now, I'm focusing on doing just the Network section, I need to know how to make the app access a .php script, and then have the response from the server printed in the lineEdit component in the screen.

    I have in Headers, inside mainwindow.h, all the slots declared when trying to connect.

    Then, I have my mainwindow.cpp with this code....

    Code:
    void MainWindow::on_pushButton_released()
    {
        QNetworkAccessManager *manager = new QNetworkAccessManager(this);
        QNetworkRequest request;
    
        request.setUrl(QUrl("http://some.website.com");
        request.setRawHeader("User-Agent","MyOwnBrowser 1.0");
    
        QNetworkReply *reply = manager->get(request);
           connect(reply, SIGNAL(readyRead()),this, SLOT(slotReadyRead()));
           connect(rely, SIGNAL(error(QNetworkReply::NetworkError)),this, SLOT(slotError(QNetworkReply::NetworkError)));
    }
    
    void MainWindow::slotReadyRead()
    {
        ui->lineEdit->setText("Ready");
    }
    
    void MainWindow::slotError(QNetworkReply::NetworkError)
    {
        ui->lineEdit->setText("Error");
    }
    Somehow, when I try to debug the app with the TRK App on the Phone (direct debugging) it always prints "Error".

    I actually have a Qt Book, but It is a little hard for me to get through the book, please need some indications here.
    What am I doing wrong?
    How can I check the QNetworkReply::NetworkError number to identify what's the problem?

    Thanks in advance, please need some answers ASAP.

    Armando Leon
    Computer Engineer (soon)

  2. #2
    Nokia Developer Moderator
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QNetwork? How? I'm a Noobie

    This topic was discussed multiple times. For instance there is a sample app:
    http://discussion.forum.nokia.com/fo...01&postcount=4

Similar Threads

  1. Mobile Development Noobie
    By nikhilk218 in forum General Development Questions
    Replies: 6
    Last Post: 2009-11-11, 09:42
  2. Digital sound (noobie!)
    By dhoskins in forum Mobile Java General
    Replies: 1
    Last Post: 2003-02-20, 05:03

Posting Permissions

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