From ce7d46d6122c0af2c5820d51bbb804bc81cdefa7 Mon Sep 17 00:00:00 2001 From: Szabolcs David Date: Wed, 14 Nov 2018 13:46:18 +0100 Subject: Docs: Extend documentation of WebActions Add some useful information. Change-Id: I39290c8dfc6c4a1d87c6b24fe6c48cab93f805db Reviewed-by: Leena Miettinen Reviewed-by: Allan Sandfeld Jensen --- .../doc/src/qwebenginepage_lgpl.qdoc | 32 ++++++++++++++-------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'src/webenginewidgets') diff --git a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc index f91b71ea1..d012c678c 100644 --- a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc +++ b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc @@ -109,9 +109,11 @@ This enum describes the types of action which can be performed on the web page. - Actions only have an effect when they are applicable. The availability of - actions can be be determined by checking \l{QAction::}{isEnabled()} on the - action returned by action(). + Actions only have an effect when they are applicable. + + The availability of actions can be be determined by checking + \l{QAction::}{isEnabled()} on the action returned by action(). Context-dependent + actions are always enabled. \value NoWebAction No action is triggered. \value Back Navigate back in the history of navigated links. @@ -128,9 +130,12 @@ \value PasteAndMatchStyle Paste content from the clipboard with current style. \value OpenLinkInThisWindow Open the current link in the current window. (Added in Qt 5.6) - \value OpenLinkInNewWindow Open the current link in a new window. (Added in Qt 5.6) - \value OpenLinkInNewTab Open the current link in a new tab. (Added in Qt 5.6) - \value OpenLinkInNewBackgroundTab Open the current link in a new background tab. (Added in Qt 5.7) + \value OpenLinkInNewWindow Open the current link in a new window. Requires implementation of + \l createWindow(). (Added in Qt 5.6) + \value OpenLinkInNewTab Open the current link in a new tab. Requires implementation of + \l createWindow(). (Added in Qt 5.6) + \value OpenLinkInNewBackgroundTab Open the current link in a new background tab. Requires + implementation of \l createWindow(). (Added in Qt 5.7) \value CopyLinkToClipboard Copy the current link to the clipboard. (Added in Qt 5.6) \value CopyImageToClipboard Copy the clicked image to the clipboard. (Added in Qt 5.6) @@ -143,9 +148,12 @@ \value ToggleMediaPlayPause Toggle the play/pause state of the hovered audio or video element. (Added in Qt 5.6) \value ToggleMediaMute Mute or unmute the hovered audio or video element. (Added in Qt 5.6) - \value DownloadLinkToDisk Download the current link to the disk. (Added in Qt 5.6) - \value DownloadImageToDisk Download the highlighted image to the disk. (Added in Qt 5.6) - \value DownloadMediaToDisk Download the hovered audio or video to the disk. (Added in Qt 5.6) + \value DownloadLinkToDisk Download the current link to the disk. Requires a slot for + \l{QWebEngineProfile::}{downloadRequested()}. (Added in Qt 5.6) + \value DownloadImageToDisk Download the highlighted image to the disk. Requires a slot for + \l{QWebEngineProfile::}{downloadRequested()}. (Added in Qt 5.6) + \value DownloadMediaToDisk Download the hovered audio or video to the disk. Requires a slot for + \l{QWebEngineProfile::}{downloadRequested()}. (Added in Qt 5.6) \value InspectElement Trigger any attached Web Inspector to inspect the highlighed element. (Added in Qt 5.6) @@ -155,8 +163,10 @@ request is confirmed, \c windowCloseRequested is emitted. (Added in Qt 5.6) \value Unselect Clear the current selection. (Added in Qt 5.7) \value SavePage Save the current page to disk. MHTML is the default format that is used to store - the web page on disk. (Added in Qt 5.7) - \value ViewSource Show the source of the current page in a new tab. (Added in Qt 5.8) + the web page on disk. Requires a slot for \l{QWebEngineProfile::}{downloadRequested()}. + (Added in Qt 5.7) + \value ViewSource Show the source of the current page in a new tab. Requires implementation of + \l createWindow(). (Added in Qt 5.8) \value ToggleBold Toggles boldness for the selection or at the cursor position. -- cgit v1.2.3 From 35ee29eb348b4629f47a6b700f9e2c356265aeba Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Wed, 21 Nov 2018 14:09:38 +0100 Subject: Fix input method update Do the update after the input properties are changed in RenderWidgetHostViewQt. Moreover, always update on input state changes, like cursor position, surrounding text and text selection (see QInputMethod::update() docs). Task-number: QTBUG-70158 Task-number: QTBUG-71995 Change-Id: I9d5c6e299826fbe66f5285b648013ef79aabed9b Reviewed-by: Allan Sandfeld Jensen --- .../render_widget_host_view_qt_delegate_widget.cpp | 9 ++------- .../render_widget_host_view_qt_delegate_widget.h | 1 - 2 files changed, 2 insertions(+), 8 deletions(-) (limited to 'src/webenginewidgets') diff --git a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp index e34bca875..900ed3324 100644 --- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp +++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp @@ -107,7 +107,6 @@ RenderWidgetHostViewQtDelegateWidget::RenderWidgetHostViewQtDelegateWidget(Rende , m_client(client) , m_rootItem(new RenderWidgetHostViewQuickItem(client)) , m_isPopup(false) - , m_isPasswordInput(false) { setFocusPolicy(Qt::StrongFocus); @@ -341,14 +340,10 @@ void RenderWidgetHostViewQtDelegateWidget::move(const QPoint &screenPos) void RenderWidgetHostViewQtDelegateWidget::inputMethodStateChanged(bool editorVisible, bool passwordInput) { - if (qApp->inputMethod()->isVisible() == editorVisible && m_isPasswordInput == passwordInput) - return; - QQuickWidget::setAttribute(Qt::WA_InputMethodEnabled, editorVisible && !passwordInput); - m_isPasswordInput = passwordInput; - qApp->inputMethod()->update(Qt::ImQueryInput | Qt::ImEnabled | Qt::ImHints); - qApp->inputMethod()->setVisible(editorVisible); + if (qApp->inputMethod()->isVisible() != editorVisible) + qApp->inputMethod()->setVisible(editorVisible); } void RenderWidgetHostViewQtDelegateWidget::setInputMethodHints(Qt::InputMethodHints hints) diff --git a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h index e23f13d86..c1cd90093 100644 --- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h +++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h @@ -110,7 +110,6 @@ private: RenderWidgetHostViewQtDelegateClient *m_client; QScopedPointer m_rootItem; bool m_isPopup; - bool m_isPasswordInput; QColor m_clearColor; QPoint m_lastGlobalPos; QList m_windowConnections; -- cgit v1.2.3 From e599907de9db0503b02a2d4a9be6d75e9542d6e3 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 29 Nov 2018 18:26:50 +0100 Subject: Document and safeguard usage of custom schemes The change improves the documentation of QWebEngineUrlSchemeHandler to notify the requirement of registering a custom scheme before installing a custom scheme handler. Also start showing warnings when QWebEngineProfile::installUrlSchemeHandler() is called before a scheme is registered. Also show warnings when installing the handler using QML. Task-number: QTBUG-72079 Change-Id: If249592ea43fe2f9ad587a6ff4e8c9dedcc5d3d3 Reviewed-by: Leena Miettinen Reviewed-by: Kai Koehne --- src/webenginewidgets/api/qwebengineprofile.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/webenginewidgets') diff --git a/src/webenginewidgets/api/qwebengineprofile.cpp b/src/webenginewidgets/api/qwebengineprofile.cpp index 537cf41fd..03ce5e0bc 100644 --- a/src/webenginewidgets/api/qwebengineprofile.cpp +++ b/src/webenginewidgets/api/qwebengineprofile.cpp @@ -52,6 +52,7 @@ #include "visited_links_manager_qt.h" #include "web_engine_settings.h" +#include QT_BEGIN_NAMESPACE @@ -688,7 +689,7 @@ static bool checkInternalScheme(const QByteArray &scheme) Registers a handler \a handler for custom URL scheme \a scheme in the profile. - It is recommended to first register the scheme with \l + It is necessary to first register the scheme with \l QWebEngineUrlScheme::registerScheme at application startup. */ void QWebEngineProfile::installUrlSchemeHandler(const QByteArray &scheme, QWebEngineUrlSchemeHandler *handler) @@ -706,6 +707,11 @@ void QWebEngineProfile::installUrlSchemeHandler(const QByteArray &scheme, QWebEn qWarning("URL scheme handler already installed for the scheme: %s", scheme.constData()); return; } + + if (QWebEngineUrlScheme::schemeByName(canonicalScheme) == QWebEngineUrlScheme()) + qWarning("Please register the custom scheme '%s' via QWebEngineUrlScheme::registerScheme() " + "before installing the custom scheme handler.", scheme.constData()); + d->profileAdapter()->addCustomUrlSchemeHandler(canonicalScheme, handler); connect(handler, SIGNAL(_q_destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler*)), this, SLOT(destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler*))); } -- cgit v1.2.3