Always set FocusOnNavigationEnabled

This fixes some focus issues after Qt 5.11 changes. There might be better ways
to solve them, but for now, this will work.

See https://codereview.qt-project.org/#/c/221408/10 and #3661:
https://github.com/qutebrowser/qutebrowser/issues/3661#issuecomment-375969315

Might also negatively affect #3834 as it essentially reintroduces QTBUG-52999 on
any Qt version: https://bugreports.qt.io/browse/QTBUG-52999

Might be reverted at a later date, but for now, I want an easy way to make tests
work on Qt 5.11 to spot further issues.
This commit is contained in:
Florian Bruhin 2018-04-23 16:57:10 +02:00
parent e789296b7f
commit fa41af63b6

View File

@ -176,12 +176,24 @@ class ProfileSetter:
"""Initialize settings on the given profile."""
self.set_http_headers()
self.set_http_cache_size()
self._profile.settings().setAttribute(
QWebEngineSettings.FullScreenSupportEnabled, True)
self._init_attributes()
if qtutils.version_check('5.8'):
self._profile.setSpellCheckEnabled(True)
self.set_dictionary_language()
def _init_attributes(self):
"""Initialize hard-coded attributes."""
values = {
'FullScreenSupportEnabled': True,
'FocusOnNavigationEnabled': True,
}
settings = self._profile.settings()
for name, value in values.items():
attr = getattr(QWebEngineSettings, name, None)
if attr is not None:
settings.setAttribute(attr, value)
def set_http_headers(self):
"""Set the user agent and accept-language for the given profile.