Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. I am a noob and I don't get how to input a value into this code and have it out put the value into a text edit? (Please Help me!)
Forum Updated to NodeBB v4.3 + New Features

I am a noob and I don't get how to input a value into this code and have it out put the value into a text edit? (Please Help me!)

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MathSquare
    wrote on last edited by
    #1

    How to get the source code from a web page with this code @QNetworkReply * QNetworkAccessManager::get(const QNetworkRequest & request)@ and I don't get how to input a website like "http://www.fsf.org/" and input it into a text edit? If you are woundering where I get this code from is from where "http://qt-project.org/doc/qt-5.0/qtnetwork/qnetworkaccessmanager.html#get". I try this code but it doesn't work @#include <QNetworkAccessManager>
    //...Code between...
    //... button push...
    ui->textEdit->setText(QNetworkReply * QNetworkAccessManager::get(const QNetworkRequest & "http://www.fsf.org/"));
    @
    Please help me.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DerManu
      wrote on last edited by
      #2

      I recommend a C++ beginner's book or tutorial. Once you've got the C++ basics, you can start with Qt.

      @ QNetworkReply * QNetworkAccessManager::get(const QNetworkRequest & request)
      @
      Means that QNetworkAccessManager instances have a method called "get". Those get methods take an argument of type "QNetworkRequest" and return a pointer to a QNetworkReply.

      Just like any other natural language, programming must be learned, and doesn't work by just hacking together stuff you think might work :). You have four problems in your one code line:

      1. A string literal is not a QNetworkRequest.
      2. get is not a static method of QNetworkAccessManager.
      3. If you use the method (as opposed to declaring it), you don't write the return type in front, but rather use it, either by calling methods on it or assigning it to a variable of that type.
      4. QNetworkReply* is not a QString.
      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved