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!)
-
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. -
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:
- A string literal is not a QNetworkRequest.
- get is not a static method of QNetworkAccessManager.
- 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.
- QNetworkReply* is not a QString.