diff options
Diffstat (limited to 'src/webengine/api')
-rw-r--r-- | src/webengine/api/qquickwebengineview.cpp | 18 | ||||
-rw-r--r-- | src/webengine/api/qquickwebengineview_p_p.h | 5 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index c6c67ff01..a47defb7c 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -61,6 +61,7 @@ #include <QQmlContext> #include <QQmlEngine> #include <QQmlProperty> +#include <QQmlWebChannel> #include <QScreen> #include <QStringBuilder> #include <QUrl> @@ -811,6 +812,23 @@ QQuickWebEngineHistory *QQuickWebEngineViewExperimental::navigationHistory() con return d_ptr->m_history.data(); } +QQmlWebChannel *QQuickWebEngineViewExperimental::webChannel() const +{ + d_ptr->ensureContentsAdapter(); + QQmlWebChannel *qmlWebChannel = qobject_cast<QQmlWebChannel *>(d_ptr->adapter->webChannel()); + Q_ASSERT(!d_ptr->adapter->webChannel() || qmlWebChannel); + if (!qmlWebChannel) { + qmlWebChannel = new QQmlWebChannel; + d_ptr->adapter->setWebChannel(qmlWebChannel); + } + return qmlWebChannel; +} + +void QQuickWebEngineViewExperimental::setWebChannel(QQmlWebChannel *webChannel) +{ + d_ptr->adapter->setWebChannel(webChannel); +} + void QQuickWebEngineViewExperimental::grantFeaturePermission(const QUrl &securityOrigin, QQuickWebEngineViewExperimental::Feature feature, bool granted) { if (!d_ptr->adapter) diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h index 48eb25cb3..d7785092f 100644 --- a/src/webengine/api/qquickwebengineview_p_p.h +++ b/src/webengine/api/qquickwebengineview_p_p.h @@ -55,6 +55,7 @@ class QQuickWebEngineView; class QQmlComponent; class QQmlContext; class QQuickWebEngineSettings; +class QQmlWebChannel; class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineViewport : public QObject { Q_OBJECT @@ -80,6 +81,7 @@ class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineViewExperimental : public QObjec Q_PROPERTY(QQmlComponent *extraContextMenuEntriesComponent READ extraContextMenuEntriesComponent WRITE setExtraContextMenuEntriesComponent NOTIFY extraContextMenuEntriesComponentChanged) Q_PROPERTY(bool isFullScreen READ isFullScreen WRITE setIsFullScreen NOTIFY isFullScreenChanged) Q_PROPERTY(QQuickWebEngineHistory *navigationHistory READ navigationHistory CONSTANT FINAL) + Q_PROPERTY(QQmlWebChannel *webChannel READ webChannel WRITE setWebChannel) Q_ENUMS(Feature) Q_FLAGS(FindFlags) @@ -103,6 +105,9 @@ public: void setExtraContextMenuEntriesComponent(QQmlComponent *); QQmlComponent *extraContextMenuEntriesComponent() const; QQuickWebEngineHistory *navigationHistory() const; + QQuickWebEngineSettings *settings() const; + QQmlWebChannel *webChannel() const; + void setWebChannel(QQmlWebChannel *); public Q_SLOTS: void goBackTo(int index); |