diff options
10 files changed, 18 insertions, 7 deletions
diff --git a/src/core/web_engine_settings.cpp b/src/core/web_engine_settings.cpp index 31d120899..da0de1de3 100644 --- a/src/core/web_engine_settings.cpp +++ b/src/core/web_engine_settings.cpp @@ -264,7 +264,7 @@ void WebEngineSettings::initDefaults() s_defaultAttributes.insert(Accelerated2dCanvasEnabled, accelerated2dCanvas); s_defaultAttributes.insert(AutoLoadIconsForPage, true); s_defaultAttributes.insert(TouchIconsEnabled, false); - s_defaultAttributes.insert(FocusOnNavigationEnabled, true); + s_defaultAttributes.insert(FocusOnNavigationEnabled, false); s_defaultAttributes.insert(PrintElementBackgrounds, true); s_defaultAttributes.insert(AllowRunningInsecureContent, allowRunningInsecureContent); s_defaultAttributes.insert(AllowGeolocationOnInsecureOrigins, false); diff --git a/src/webengine/api/qquickwebenginesettings.cpp b/src/webengine/api/qquickwebenginesettings.cpp index 98a3eef39..12d313783 100644 --- a/src/webengine/api/qquickwebenginesettings.cpp +++ b/src/webengine/api/qquickwebenginesettings.cpp @@ -311,8 +311,7 @@ bool QQuickWebEngineSettings::touchIconsEnabled() const Focus is given to the view whenever a navigation operation occurs (load, stop, reload, reload and bypass cache, forward, backward, set content, and so on). - Enabled by default. See \l{WebEngine Recipe Browser} for an example where - this property is disabled. + Disabled by default. */ bool QQuickWebEngineSettings::focusOnNavigationEnabled() const { diff --git a/src/webengine/doc/src/webengineview.qdoc b/src/webengine/doc/src/webengineview.qdoc index e14448aa4..9cd7e3f27 100644 --- a/src/webengine/doc/src/webengineview.qdoc +++ b/src/webengine/doc/src/webengineview.qdoc @@ -86,7 +86,7 @@ focus on press. This can be useful in a hybrid UI. The \l {WebEngineSettings::focusOnNavigationEnabled} {focusOnNavigationEnabled} setting can be - used to stop the view from automatically receiving focus when a navigation operation occurs + used to make the view automatically receive focus when a navigation operation occurs (like loading or reloading a page or navigating through history). The \l linkHovered() signal is emitted when a mouse pointer passes over a link and thus diff --git a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc index 3b9300a4b..5248a383a 100644 --- a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc +++ b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc @@ -89,8 +89,8 @@ \c MainWorld. The \l {QWebEngineSettings::FocusOnNavigationEnabled} {FocusOnNavigationEnabled} setting can be - used to stop the view associated with the page from automatically receiving focus when a - navigation operation occurs (like loading or reloading a page or navigating through history). + used to make the view associated with the page automatically receive focus when a navigation + operation occurs (like loading or reloading a page or navigating through history). */ /*! diff --git a/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc index 907f6f643..e6a94281e 100644 --- a/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc +++ b/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc @@ -148,7 +148,7 @@ Gives focus to the view associated with the page, whenever a navigation operation occurs (load, stop, reload, reload and bypass cache, forward, backward, set content, and so on). - Enabled by default. (Added in Qt 5.8) + Disabled by default. (Added in Qt 5.8) \value PrintElementBackgrounds Turns on printing of CSS backgrounds when printing a web page. Enabled by default. (Added in Qt 5.8) diff --git a/tests/auto/quick/qmltests/data/TestWebEngineView.qml b/tests/auto/quick/qmltests/data/TestWebEngineView.qml index a7d890072..8304a993a 100644 --- a/tests/auto/quick/qmltests/data/TestWebEngineView.qml +++ b/tests/auto/quick/qmltests/data/TestWebEngineView.qml @@ -33,6 +33,7 @@ import QtWebEngine 1.3 WebEngineView { property var loadStatus: null property bool windowCloseRequestedSignalEmitted: false + settings.focusOnNavigationEnabled: true function waitForLoadSucceeded() { var success = _waitFor(function() { return loadStatus == WebEngineView.LoadSucceededStatus }) diff --git a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp index 8c3e2256b..8aea72cca 100644 --- a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp +++ b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp @@ -447,6 +447,7 @@ void tst_QQuickWebEngineView::inputMethod() QQuickItem *input; QQuickWebEngineView *view = webEngineView(); + view->settings()->setFocusOnNavigationEnabled(true); view->setUrl(urlFromTestPath("html/inputmethod.html")); QVERIFY(waitForLoadSucceeded(view)); @@ -474,6 +475,7 @@ void tst_QQuickWebEngineView::inputMethodHints() QQuickItem *input; QQuickWebEngineView *view = webEngineView(); + view->settings()->setFocusOnNavigationEnabled(true); view->setUrl(urlFromTestPath("html/inputmethod.html")); QVERIFY(waitForLoadSucceeded(view)); @@ -565,6 +567,7 @@ void tst_QQuickWebEngineView::stopSettingFocusWhenDisabled() QQuickWebEngineView *view = webEngineView(); m_window->show(); + view->settings()->setFocusOnNavigationEnabled(true); view->setSize(QSizeF(640, 480)); view->setEnabled(viewEnabled); view->loadHtml("<html><head><title>Title</title></head><body>Hello" diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index bea44f73c..5f3a7e728 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -251,6 +251,7 @@ void tst_QWebEnginePage::init() m_view = new QWebEngineView(); m_page = m_view->page(); m_page->settings()->setAttribute(QWebEngineSettings::ErrorPageEnabled, false); + m_view->settings()->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled, true); } void tst_QWebEnginePage::cleanup() diff --git a/tests/auto/widgets/qwebenginespellcheck/tst_qwebenginespellcheck.cpp b/tests/auto/widgets/qwebenginespellcheck/tst_qwebenginespellcheck.cpp index d5e8a21cf..4f14f29f9 100644 --- a/tests/auto/widgets/qwebenginespellcheck/tst_qwebenginespellcheck.cpp +++ b/tests/auto/widgets/qwebenginespellcheck/tst_qwebenginespellcheck.cpp @@ -32,6 +32,7 @@ #include <QtWebEngineWidgets/qwebengineprofile.h> #include <QtWebEngineWidgets/qwebenginepage.h> #include <QtWebEngineWidgets/qwebengineview.h> +#include <qwebenginesettings.h> class WebView : public QWebEngineView { @@ -143,6 +144,8 @@ void tst_QWebEngineSpellcheck::spellcheck() QFETCH(QStringList, languages); QFETCH(QStringList, suggestions); + m_view->settings()->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled, true); + QWebEngineProfile *profile = QWebEngineProfile::defaultProfile(); QVERIFY(profile); profile->setSpellCheckLanguages(languages); diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp index 5fe02ce5d..8f9efdbc2 100644 --- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp +++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp @@ -1067,6 +1067,7 @@ void tst_QWebEngineView::inputMethodsTextFormat_data() void tst_QWebEngineView::inputMethodsTextFormat() { QWebEngineView view; + view.settings()->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled, true); QSignalSpy loadFinishedSpy(&view, SIGNAL(loadFinished(bool))); view.setHtml("<html><body>" @@ -1205,6 +1206,7 @@ void tst_QWebEngineView::keyboardFocusAfterPopup() urlLine->setFocus(); QWebEngineView *webView = new QWebEngineView(containerWidget.data()); + webView->settings()->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled, true); QSignalSpy loadFinishedSpy(webView, SIGNAL(loadFinished(bool))); connect(urlLine, &QLineEdit::editingFinished, [=] { @@ -2222,6 +2224,8 @@ void tst_QWebEngineView::imeCompositionQueryEvent_data() void tst_QWebEngineView::imeCompositionQueryEvent() { QWebEngineView view; + view.settings()->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled, true); + view.show(); QSignalSpy loadFinishedSpy(&view, SIGNAL(loadFinished(bool))); |