diff options
Diffstat (limited to 'src/plugins/qwebengineview/qwebengineview_plugin.h')
-rw-r--r-- | src/plugins/qwebengineview/qwebengineview_plugin.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/plugins/qwebengineview/qwebengineview_plugin.h b/src/plugins/qwebengineview/qwebengineview_plugin.h index 8fa94625c..7c6f02e2a 100644 --- a/src/plugins/qwebengineview/qwebengineview_plugin.h +++ b/src/plugins/qwebengineview/qwebengineview_plugin.h @@ -38,9 +38,43 @@ #define QWEBENGINEVIEW_PLUGIN_H #include <QtUiPlugin/QDesignerCustomWidgetInterface> +#include <QtWidgets/QWidget> +#include <QtGui/QIcon> +#include <QtCore/QUrl> QT_BEGIN_NAMESPACE +namespace fake { +// A lightweight "fake" QWebEngineView class that is returned when Qt Designer +// queries the default property values by calling +// QDesignerCustomWidgetInterface::createWidget() with 0 parent, preventing +// crashes during QWebEngine initialization (QTBUG-53984). +// The property list needs to be kept in sync with QWebEngineView. +class QWebEngineView : public QWidget { + Q_OBJECT + Q_PROPERTY(QString title READ title) + Q_PROPERTY(QUrl url READ url WRITE setUrl) // Designable + Q_PROPERTY(QUrl iconUrl READ iconUrl) + Q_PROPERTY(QIcon icon READ icon) + Q_PROPERTY(QString selectedText READ selectedText) + Q_PROPERTY(bool hasSelection READ hasSelection) + Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor) // Designable + +public: + explicit QWebEngineView(QWidget *parent = Q_NULLPTR) : QWidget(parent) {} + + QString title() const { return QString(); } + QUrl url() const { return QUrl(); } + void setUrl(const QUrl &) {} + QUrl iconUrl() const { return QUrl(); } + QIcon icon() const { return QIcon(); } + QString selectedText() { return QString(); } + bool hasSelection() { return false; } + qreal zoomFactor() const { return 1; } + void setZoomFactor(qreal) {} +}; +} // namespace fake + class QWebEngineViewPlugin: public QObject, public QDesignerCustomWidgetInterface { Q_OBJECT |