I'm trying to use QtCreator and QT5 on Windows to create a very basic QWebView. However no matter what I do I cannot get past the error: "QWebView: No such file or directory". I've googled this issue, I've added += webkit to my pro file, and I've tried cleaning and running qmake a number of time but nothing works. Am including contents of my .cpp and .pro file in case I'm doing something wrong somebody can point out -- the code is something I found on the web, and the .pro is mostly boilerplater created by QtCreator. Thanks in advance.
#include <QtGui>
#include <QWebView>
int main(int argc, char** argv) {
QWebView* view = new QWebView;
view
->setUrl
(QUrl("http://localhost"));
view->show();
return app.exec();
}
#include <QtGui>
#include <QWebView>
int main(int argc, char** argv) {
QApplication app(argc, argv);
QWebView* view = new QWebView;
view->setUrl(QUrl("http://localhost"));
view->show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
QT += core gui webkit
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = QWebViewGuiTest
TEMPLATE = app
SOURCES += main.cpp
QT += core gui webkit
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = QWebViewGuiTest
TEMPLATE = app
SOURCES += main.cpp
To copy to clipboard, switch view to plain text mode
Bookmarks