PDA

View Full Version : Using QtCreator and QT5 on Windows and "QWebView: no such file or directory" issue



dexygen
9th April 2013, 01:36
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) {

QApplication app(argc, argv);

QWebView* view = new QWebView;
view->setUrl(QUrl("http://localhost"));
view->show();

return app.exec();
}


QT += core gui webkit

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = QWebViewGuiTest
TEMPLATE = app

SOURCES += main.cpp

ChrisW67
9th April 2013, 07:43
You need:


QT += qtwebkitwidgets

http://qt-project.org/doc/qt-5.0/qtwebkit/qtwebkit-module.html

dexygen
9th April 2013, 11:33
You need:


QT += qtwebkitwidgets

http://qt-project.org/doc/qt-5.0/qtwebkit/qtwebkit-module.html

I will take a longer look at the URL you provided later today but I tried adding what you suggested to my .pro file and now get this error running qmake:

"Unknown module(s) in QT: qtwebkitwidgets"

ntXn
9th April 2013, 12:45
Try this

QT += webkitwidgets
http://qt-project.org/doc/qt-5.0/qtwebkit/qtwebkitwidgets-index.html

ChrisW67
9th April 2013, 22:00
Yes, my bad.

dexygen
10th April 2013, 11:20
QT += webkitwidgets worked, thanks very much!