I have never studied networks. I have never studied networks. It took several days to get online.
If you want to learn some QT, you can play on the qt creator. What about layout and Pushbutton? After a long time, I suddenly saw qwebview. I think this may be something that can display webpages. Drag and play. Compilation fails. Why? Find it. It turns out that QT ++ = WebKit is missing in the. Pro file. Compile it. Hey, it passes. But nothing is shown. What is going on?
More than half a day later, I think of his own demo example. Load it in. Still in the connecting status, that is, the connection fails, alas. Ask someone else. PM, fat man, spoke up. Have you checked the proxy settings?
It's strange that all my proxies have been set up. Find them in the east and find them in the West. After seeing the demo running, I have a proxy set myself. Please change it. Haha, it succeeded.
All of a sudden, I understand that our network is in the domain and we should have a proxy to connect to the Internet. Although I am not familiar with Agent, I may know what is going on. I will study it later.
After a few days, continue to write the program. Refer to the demo to set the proxy method. I added some items in my mainwindow. h:
# Include <qtwebkit/qwebview>
# Include <qtnetwork/qnetworkproxy>
# Include <qtnetwork/qnetworkaccessmanager>
# Include <qsettings>
# Include <qtextcodec>
Class mainwindow: Public qmainwindow
{
...
PRIVATE:
Ui: mainwindow * UI;
Qwebview * webv;
Qnetworkproxy * proxy;
Qnetworkaccessmanager * netwkacssmng;
};
Code is also added in mainwindow. cpp:
Mainwindow: mainwindow (qwidget * parent)
: Qmainwindow (parent), UI (new UI: mainwindow)
{
...
Webv = qfindchild <qwebview *> (this, "webview ");
Netwkacssmng = new qnetworkaccessmanager;
Qnetworkproxy proxy;
Proxy = qnetworkproxy: httpproxy;
Proxy. sethostname (TR ("xx. xx"); // Proxy Server
Proxies. setport (8080 );
Netwkacssmng-> setproxy (proxy );
Webv-> page ()-> setnetworkaccessmanager (netwkacssmng );
Webv-> load (qurl ("http://www.google.com.hk /"));
Webv-> show ();
}
The compilation failed. It was found that QT ++ = WebKit network was missing in the. Pro file for the whole day.
Finally passed. Wait for the test. Haha ~
Successful! The Google page is displayed successfully. Although it was a small success, it was still quite happy.
I forgot. I also deleted netwkacssmng. Haha.
Maybe you shouldn't delete netwkacssmng. It's all webv pages.