Complementary&Statement:
This programe are desined to study the use of
Qt’s WebKit module. If you have any question, you can find some help in the following website.
The web site is:http://doc.qt.nokia.com/4.7/webkit-fancybrowser.html
You may could not usethe webkit before adding the code as in the the following to your qmake.profile.
QT += core gui \
Webkit
At last ,we willexplain the QtBrowse project in detail. First will shoule create anew project named QtBrowse. In the class information tab item,we choose theQMainWindow class and make the checkbox unchecked,then goahead with the default settings.
Explanation:
1)
QFile::setFileName
Set the name of thefile,which has no path,relative path and absolute path. If it has no path or arelative path.The current path of application is the same as it.
Example:
QFile file;
QDir::setCurrent("/tmp");
file.setFileName("readme.txt");
QDir::setCurrent("/home");
file.open(QIODevice::ReadOnly);
2)
QWebView
The QWebView class provide a widget that isused to view and edit web documents.
QWebView::load(const QUrl &url);
Load the specied url and show the website.
3)
Icon is one ofresource of Qt. In the content of the type of qrc file includerelative path of Icon.rcc is the resource debug of Qt, which bebug the qrcfile. We can use the object in the process of debug.
There are many kinds of picture file ,but weregularly use the png format. For example :
<!DOCTYPERCC><RCC version="1.0">
<qresource>
<file>images/copy.png</file>
<file>images/cut.png</file>
<file>images/new.png</file>
<file>images/open.png</file>
<file>images/paste.png</file>
<file>images/save.png</file>
</qresource>
</RCC>
We can see clearly from the example, the formatof the .qrc is xml.
Attention: Icon file should have the samepath as qrc file or in the same subdirectory.