Skip to content

Commit

Permalink
Fix error since QGIS 3.36.0+: Failed to create OpenGL context for for…
Browse files Browse the repository at this point in the history
…mat QSurfaceFormat(...).

This is most likely caused by not having the necessary graphics drivers installed

https://github.com/qt/qtdeclarative/blob/v5.15.3-lts-lgpl/src/quick/items/qquickwindow.cpp#L1457

Signed-off-by: minff <[email protected]>
  • Loading branch information
minff committed Mar 7, 2024
1 parent b3ae9a1 commit 4a98d97
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions XYZHubConnector/xyz_qgis/iml/network/login_webengine.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
except Exception as e:
PYQT_STR = "PyQt (unknown){error}".format(error=" - " + repr(e))

from PyQt5.QtGui import QSurfaceFormat
from PyQt5.QtQuick import QQuickView


from qgis.PyQt.QtCore import QUrl, QObject
from qgis.PyQt.QtCore import Qt
from qgis.PyQt.QtNetwork import (
Expand Down Expand Up @@ -123,6 +125,7 @@ def get_access_token(self, conn_info: SpaceConnectionInfo) -> str:

@classmethod
def create_qml_view(cls, login_url: str, title="", cb_login_view_closed=None):
QSurfaceFormat.setDefaultFormat(QSurfaceFormat())

view = QQuickView()
engine = view.engine()
Expand Down

0 comments on commit 4a98d97

Please sign in to comment.