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 --- src/webengine/api/qquickwebengineaction.cpp | 3 ++- src/webengine/doc/src/webengineview_lgpl.qdoc | 13 ++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'src/webengine') diff --git a/src/webengine/api/qquickwebengineaction.cpp b/src/webengine/api/qquickwebengineaction.cpp index 16eef04d3..f5b780ea6 100644 --- a/src/webengine/api/qquickwebengineaction.cpp +++ b/src/webengine/api/qquickwebengineaction.cpp @@ -146,7 +146,8 @@ QString QQuickWebEngineAction::iconName() const /*! \qmlproperty bool WebEngineAction::enabled - This property holds whether the action is enabled. + This property holds whether the action is enabled. Context-dependent + actions are always enabled. */ bool QQuickWebEngineAction::isEnabled() const { diff --git a/src/webengine/doc/src/webengineview_lgpl.qdoc b/src/webengine/doc/src/webengineview_lgpl.qdoc index 87094c266..0e25e16f3 100644 --- a/src/webengine/doc/src/webengineview_lgpl.qdoc +++ b/src/webengine/doc/src/webengineview_lgpl.qdoc @@ -754,9 +754,11 @@ \value WebEngineView.OpenLinkInThisWindow Open the current link in the current window. (Added in Qt 5.6) \value WebEngineView.OpenLinkInNewWindow - Open the current link in a new window. (Added in Qt 5.6) + Open the current link in a new window. Requires a handler for the + \l newViewRequested() signal. (Added in Qt 5.6) \value WebEngineView.OpenLinkInNewTab - Open the current link in a new tab. (Added in Qt 5.6) + Open the current link in a new tab. Requires a handler for the + \l newViewRequested() signal. (Added in Qt 5.6) \value WebEngineView.CopyLinkToClipboard Copy the current link to the clipboard. (Added in Qt 5.6) \value WebEngineView.CopyImageToClipboard @@ -777,8 +779,8 @@ Mute or unmute the hovered audio or video element. (Added in Qt 5.6) \value WebEngineView.DownloadLinkToDisk Download the current link to the disk. To implement download - actions, connect to the QWebEngineProfile::downloadRequested signal. - (Added in Qt 5.6) + actions, connect to the \l {QQuickWebEngineProfile::downloadRequested} + {WebEngineProfile.downloadRequested} signal. (Added in Qt 5.6) \value WebEngineView.DownloadImageToDisk Download the highlighted image to the disk. (Added in Qt 5.6) \value WebEngineView.DownloadMediaToDisk @@ -791,7 +793,8 @@ \value WebEngineView.SavePage Save the current web page to disk. (Added in Qt 5.7) \value WebEngineView.ViewSource - Show the source of the current page in a new tab. (Added in Qt 5.8) + Show the source of the current page in a new tab. Requires a handler for the + \l newViewRequested() signal. (Added in Qt 5.8) \value WebEngineView.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 --- src/webengine/render_widget_host_view_qt_delegate_quick.cpp | 7 ++----- src/webengine/render_widget_host_view_qt_delegate_quick.h | 1 - 2 files changed, 2 insertions(+), 6 deletions(-) (limited to 'src/webengine') diff --git a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp index 1176573fd..2f65db97a 100644 --- a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp +++ b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp @@ -54,7 +54,6 @@ namespace QtWebEngineCore { RenderWidgetHostViewQtDelegateQuick::RenderWidgetHostViewQtDelegateQuick(RenderWidgetHostViewQtDelegateClient *client, bool isPopup) : m_client(client) , m_isPopup(isPopup) - , m_isPasswordInput(false) { setFlag(ItemHasContents); setAcceptedMouseButtons(Qt::AllButtons); @@ -206,11 +205,9 @@ void RenderWidgetHostViewQtDelegateQuick::inputMethodStateChanged(bool editorVis if (parentItem()) parentItem()->setFlag(QQuickItem::ItemAcceptsInputMethod, editorVisible && !passwordInput); - if (qApp->inputMethod()->isVisible() != editorVisible || m_isPasswordInput != passwordInput) { - qApp->inputMethod()->update(Qt::ImQueryInput | Qt::ImEnabled | Qt::ImHints); + qApp->inputMethod()->update(Qt::ImQueryInput | Qt::ImEnabled | Qt::ImHints); + if (qApp->inputMethod()->isVisible() != editorVisible) qApp->inputMethod()->setVisible(editorVisible); - m_isPasswordInput = passwordInput; - } } bool RenderWidgetHostViewQtDelegateQuick::event(QEvent *event) diff --git a/src/webengine/render_widget_host_view_qt_delegate_quick.h b/src/webengine/render_widget_host_view_qt_delegate_quick.h index 6f6cd1509..d4d64804a 100644 --- a/src/webengine/render_widget_host_view_qt_delegate_quick.h +++ b/src/webengine/render_widget_host_view_qt_delegate_quick.h @@ -113,7 +113,6 @@ private: RenderWidgetHostViewQtDelegateClient *m_client; QList m_windowConnections; bool m_isPopup; - bool m_isPasswordInput; QPointF m_lastGlobalPos; QQuickWebEngineView *m_view = nullptr; }; -- cgit v1.2.3 From f7110be2c88596814d1210d8fe1af9c501f9555e Mon Sep 17 00:00:00 2001 From: Szabolcs David Date: Wed, 28 Nov 2018 14:09:50 +0100 Subject: Avoid binding loops caused by default context menu When a WebEngineAction is tied to a UI element and a context menu request modifies its enabled state, the users get a warning: 'Binding loop detected for property "enabled"' Avoid triggering the action's notifier signal when the default context menu is being built. Change-Id: Ie23087f0b879399cf1cb88c44a42cd0be537a750 Reviewed-by: Allan Sandfeld Jensen --- src/webengine/api/qquickwebengineaction_p_p.h | 6 +++--- src/webengine/api/qquickwebengineview.cpp | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src/webengine') diff --git a/src/webengine/api/qquickwebengineaction_p_p.h b/src/webengine/api/qquickwebengineaction_p_p.h index 4320f73e4..d2ead30e9 100644 --- a/src/webengine/api/qquickwebengineaction_p_p.h +++ b/src/webengine/api/qquickwebengineaction_p_p.h @@ -72,13 +72,13 @@ public: void trigger(); -private: - QQuickWebEngineAction *q_ptr; - QVariant m_data; QString m_text; QString m_iconName; bool m_enabled; + +private: + QQuickWebEngineAction *q_ptr; }; QT_END_NAMESPACE diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index d9667a643..b9ae06aeb 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -2225,7 +2225,8 @@ void QQuickContextMenuBuilder::addMenuItem(ContextMenuItem menuItem) m_view->d_ptr->ui()->addMenuSeparator(m_menu); return; } - action->d_ptr->setEnabled(isMenuItemEnabled(menuItem)); + // Set enabled property directly with avoiding binding loops caused by its notifier signal. + action->d_ptr->m_enabled = isMenuItemEnabled(menuItem); m_view->d_ptr->ui()->addMenuItem(action, m_menu); } -- 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/webengine/api/qquickwebengineprofile.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/webengine') diff --git a/src/webengine/api/qquickwebengineprofile.cpp b/src/webengine/api/qquickwebengineprofile.cpp index ed2600e49..ddc71602b 100644 --- a/src/webengine/api/qquickwebengineprofile.cpp +++ b/src/webengine/api/qquickwebengineprofile.cpp @@ -53,6 +53,8 @@ #include "renderer_host/user_resource_controller_host.h" #include "web_engine_settings.h" +#include + using QtWebEngineCore::ProfileAdapter; QT_BEGIN_NAMESPACE @@ -857,7 +859,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 QQuickWebEngineProfile::installUrlSchemeHandler(const QByteArray &scheme, QWebEngineUrlSchemeHandler *handler) @@ -875,6 +877,11 @@ void QQuickWebEngineProfile::installUrlSchemeHandler(const QByteArray &scheme, Q 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 From a9fc32bafccea8c57260b7dcec0cc3143b493578 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Thu, 13 Dec 2018 13:22:04 +0100 Subject: Doc: Add full stop to the end of brief statement To get rid of a QDoc warning. Change-Id: Ib5d25edcf3b7e4a9786dd2056b025757ed5f7beb Reviewed-by: Kai Koehne --- src/webengine/api/qquickwebengineaction.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/webengine') diff --git a/src/webengine/api/qquickwebengineaction.cpp b/src/webengine/api/qquickwebengineaction.cpp index f5b780ea6..69a05f29b 100644 --- a/src/webengine/api/qquickwebengineaction.cpp +++ b/src/webengine/api/qquickwebengineaction.cpp @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE \inqmlmodule QtWebEngine \since QtWebEngine 1.8 - \brief An action that represents a \l WebEngineView::WebAction + \brief An action that represents a \l WebEngineView::WebAction. A WebEngineAction is returned by the \l WebEngineView::action() method. It provides information about the action, such as -- cgit v1.2.3 From 4f1e0003d98116e33a847360e0e95c46daae25fc Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Thu, 13 Dec 2018 14:47:35 +0100 Subject: Doc: Fix a broken link to macOS requirements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The docs we restructured for 5.12. Change-Id: I0b879bc9fb085d5743a16bc89d405e11f22ca66c Reviewed-by: Tor Arne Vestbø --- src/webengine/doc/src/qtwebengine-platform-notes.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/webengine') diff --git a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc index 59429ec5a..0b2aebfce 100644 --- a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc +++ b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc @@ -41,7 +41,7 @@ \list \li \l{Qt for Windows - Requirements} \li \l{Qt for X11 Requirements} - \li \l{Qt for macOS - Requirements} + \li \l{Qt for macOS - Building from Source} \endlist In addition, the following tools are required for building the \l {Qt WebEngine} module: -- cgit v1.2.3