diff options
Diffstat (limited to 'qutebrowser/misc/earlyinit.py')
-rw-r--r-- | qutebrowser/misc/earlyinit.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/qutebrowser/misc/earlyinit.py b/qutebrowser/misc/earlyinit.py index b154eaca8..ecd3fac1a 100644 --- a/qutebrowser/misc/earlyinit.py +++ b/qutebrowser/misc/earlyinit.py @@ -279,6 +279,21 @@ def check_optimize_flag(): "unexpected behavior may occur.") +def webengine_early_import(): + """If QtWebEngine is available, import it early. + + We need to ensure that QtWebEngine is imported before a QApplication is created for + everything to work properly. + + This needs to be done even when using the QtWebKit backend, to ensure that e.g. + error messages in backendproblem.py are accurate. + """ + try: + from PyQt5 import QtWebEngineWidgets + except ImportError: + pass + + def early_init(args): """Do all needed early initialization. @@ -303,3 +318,4 @@ def early_init(args): configure_pyqt() check_ssl_support() check_optimize_flag() + webengine_early_import() |