I have never used Qt
and WebKit
and now have a need to create a simple single web page browser using the Qt WebKit module
. The application
Your requirement is still not scoped enough. If you want the simplest possible full application example which displays a web page, here is the code:
#include
#include
int main(int argc, char** argv) {
QApplication app(argc, argv);
QWebView view;
view.show();
view.setUrl(QUrl("http://google.com"));
return app.exec();
}
If that is example.cpp
, you can use the following example.pro
:
QT += webkit
SOURCES = example.cpp
The easiest way to Qt development is using Qt Creator and you can load that .pro file with Qt Creator, build the app, and launch it. There is only one window (QWebView
instance) and it will open Google homepage.