PDA

View Full Version : It crashes when using QWebView to show a website



jeffw
7th April 2014, 07:46
I run it on windows 8.1, with Qt 5.1.0, and IDE is Visual Studio 2010 professional.
Here is the code:

#include <QApplication>
#include <QtWebKitWidgets/QWebView>

int main(int argc, char * argv[])
{
QApplication app(argc, argv);

QWebView view;
//QCoreApplication::addLibraryPath("./plugins");
view.settings()->setAttribute(QWebSettings::PluginsEnabled, true);
// crash
view.load(QUrl("http://hon.qq.com/act/20140320video/Aluna.html"));
// OK
//view.load(QUrl("http://www.youtube.com/watch?v=KMU0tzLwhbE"));
view.show();

return app.exec();
}

It is OK to show YouTube. It is really weird. I attached the dialog when crash.
10271

budda
9th April 2014, 09:44
it could be so many reasons....
1. what does your .pro file look like? does it have QT += webkit webkitwidgets network ?
2. maybe your build didn't do Webkit properly because of ANGLE or OpenGL with Qt/Visual2010
3. why do you call a QWebView from main? not mainwindow.cpp or dialog.cpp?
4. maybe you should look at the simple web browser program that is an example code.....

wysota
9th April 2014, 10:38
The error dialog clearly indicates the problem is related to dereferencing an uninitialized or otherwise invalid pointer. If you want more meaningful information, run the application under a debugger and provide us with the backtrace.