Use QTwebkit to parse html in windows

Source: Internet
Author: User

Environment

windows7 + VS2010 + QT5.2_opengl
Configure the development environment

1. Install VS2010

2. Install the QT 5.2

QT Website: http://qt-project.org/downloads

Download and install QT5.2: Qt 5.2.1 for Windows 32-bit (VS 2010, OpenGL, 517 MB)

3. Install Visual Studio Add-in for QT5

: Visual Studio Add-in 1.2.2 for Qt5

4. Configure VS 2010

Configuration path: QT5 ==> "Qt Options" ==> "Qt Versions" ==> Add

Default path: C: \ Qt \ Qt5.2.0 \ 5.2.0 \ msvc2010_opengl

Parse html

1. Establish the QtWebkit Project

Operation path: VS2010 ==> File ==> New ==> Project ==> "Qt5 Projects" ==> "Qt Application"

Notes

Select "WebKit" and "Webkit Widgets" in "Project Settings: 

2. Add a header file

#include <QtGui><QtWebKit><QWebView>

3.1 parse an http url

Use the setUrl method of QWebView as follows:

));

Use the setUrl method of QWebView as follows:

));

Use the setHtml method of QWebView as follows:

<<

<QtWebKit> <QWebView> <fstream> <sstream> main (argc, * std: ifstream fin (<View Code

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.