diff options
author | Alexandru Croitor <alexandru.croitor@theqtcompany.com> | 2016-05-09 09:26:27 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@theqtcompany.com> | 2016-05-26 09:05:08 +0000 |
commit | 4c305cba0bf7cc021fd355af574b431f0d5a057d (patch) | |
tree | 1dd294e4405179efc3a154badccfc8a891a82a05 /src/webenginewidgets | |
parent | aeea8816a7228e9e89fff15b26005eaaa38fce2d (diff) |
Disabled WebEngine views should not receive focus.
Currently if a QWebEngineView or a QQuickWebEngineView is disabled
using setEnabled(false), after loading a web page, the views are
automatically focused, and a user might see a blinking caret in an html
input for example, even though the user can't interact with it.
Fix consists in not calling the Focus() method whenever a view is
disabled.
Change-Id: I1014fb5898a5ddf01a4e9b14c3eaf5d4006e5131
Task-number: QTBUG-53159
Reviewed-by: Michal Klocek <michal.klocek@theqtcompany.com>
Diffstat (limited to 'src/webenginewidgets')
-rw-r--r-- | src/webenginewidgets/api/qwebenginepage.cpp | 9 | ||||
-rw-r--r-- | src/webenginewidgets/api/qwebenginepage_p.h | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index 7795cc41d..2fd026682 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -1071,6 +1071,15 @@ void QWebEnginePagePrivate::requestGeometryChange(const QRect &geometry) Q_EMIT q->geometryChangeRequested(geometry); } +bool QWebEnginePagePrivate::isEnabled() const +{ + const Q_Q(QWebEnginePage); + const QWidget *view = q->view(); + if (view) + return view->isEnabled(); + return true; +} + QMenu *QWebEnginePage::createStandardContextMenu() { Q_D(QWebEnginePage); diff --git a/src/webenginewidgets/api/qwebenginepage_p.h b/src/webenginewidgets/api/qwebenginepage_p.h index 3738de3cf..8e5be51d0 100644 --- a/src/webenginewidgets/api/qwebenginepage_p.h +++ b/src/webenginewidgets/api/qwebenginepage_p.h @@ -124,6 +124,7 @@ public: virtual void renderProcessTerminated(RenderProcessTerminationStatus terminationStatus, int exitCode) Q_DECL_OVERRIDE; virtual void requestGeometryChange(const QRect &geometry) Q_DECL_OVERRIDE; + virtual bool isEnabled() const Q_DECL_OVERRIDE; virtual QSharedPointer<QtWebEngineCore::BrowserContextAdapter> browserContextAdapter() Q_DECL_OVERRIDE; |