WebKit (Qt 5.3) not works on Windows XP SP3.
Hello!
A very simple 32-bit application has been written.
This application uses QtWebView to display WEB page in main window.
The application has been developed on Windows, Qt 5.3.1 for Windows 32-bit (VS 2013).
The application has been builded in Visual Studio 2013 (Update 3) with toolset v120_xp.
The application works correctly on Windows 7 (32-bit and 64-bit).
But this application not works on Windows XP SP3 32-bit – terminates during displaying WEB page on QWebView.
If I comment the line ‘ui.webView->setUrl(QUrl(…))’ in the source code (see below) – this application starts without problems.
How to fix this problem?
Thanks!
Source code:
// main.cpp
#include "qtwebkit.h"
#include <QtWidgets/QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
a.addLibraryPath(QCoreApplication::applicationDirPath() + "/plugins");
QtWebKit w;
w.show();
return a.exec();
}
// qtwebkit.h
#ifndef QTWEBKIT_H
#define QTWEBKIT_H
#include <QtWidgets/QMainWindow>
#include "ui_qtwebkit.h"
class QtWebKit : public QMainWindow
{
Q_OBJECT
public:
QtWebKit(QWidget *parent = 0);
~QtWebKit();
protected:
void showEvent(QShowEvent* event);
private:
Ui::QtWebKitClass ui;
};
#endif // QTWEBKIT_H
// qtwebkit.cpp
#include "qtwebkit.h"
#include <QObject>
#include <QWebView>
QtWebKit::QtWebKit(QWidget *parent)
: QMainWindow(parent)
{
ui.setupUi(this);
}
QtWebKit::~QtWebKit()
{
}
void QtWebKit::showEvent(QShowEvent* event)
{
ui.webView->setVisible(true);
ui.webView->setUrl(QUrl("http://www.ibm.com/us/en/"));
}
// qtwebkit.ui
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QtWebKitClass</class>
<widget class="QMainWindow" name="QtWebKitClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>400</height>
</rect>
</property>
<property name="windowTitle">
<string>QtWebKit</string>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QWebView" name="webView">
<property name="url">
<url>
<string>about:blank</string>
</url>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QToolBar" name="mainToolBar">
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widget class="QStatusBar" name="statusBar"/>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>QWebView</class>
<extends>QWidget</extends>
<header>QtWebKitWidgets/QWebView</header>
</customwidget>
</customwidgets>
<resources>
<include location="qtwebkit.qrc"/>
</resources>
<connections/>
</ui>
—————————————————————————
↧