From ec31e187d033da2e0edf0c0a1280b81aa1055f9e Mon Sep 17 00:00:00 2001 From: mara004 <65915611+mara004@users.noreply.github.com> Date: Sun, 2 May 2021 15:09:53 +0200 Subject: [PATCH 1/3] Quick and dirty fix for #207 Move away from the deprecated QGLWidget and replace it with QOpenGLWidget This fixes the Wayland OpenGL issues described in #207 (in a very rough way) --- NodeGraphQt/widgets/viewer.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/NodeGraphQt/widgets/viewer.py b/NodeGraphQt/widgets/viewer.py index 04070268..9c5b9af1 100644 --- a/NodeGraphQt/widgets/viewer.py +++ b/NodeGraphQt/widgets/viewer.py @@ -2,7 +2,12 @@ # -*- coding: utf-8 -*- import math -from Qt import QtGui, QtCore, QtWidgets, QtOpenGL +from Qt import QtGui, QtCore, QtWidgets + +try: + from PySide2.QtWidgets import QOpenGLWidget +except Exception: + from PyQt5.QtWidgets import QOpenGLWidget from .dialogs import BaseDialog, FileDialog from .scene import NodeScene @@ -1150,6 +1155,4 @@ def clear_key_state(self): self.ALT_state = False def use_OpenGL(self): - format = QtOpenGL.QGLFormat(QtOpenGL.QGL.SampleBuffers) - format.setSamples(4) - self.setViewport(QtOpenGL.QGLWidget(format)) + self.setViewport(QOpenGLWidget()) From 5a1c1e73a7e012900943ca1f374ddded1b43f14b Mon Sep 17 00:00:00 2001 From: mara004 <65915611+mara004@users.noreply.github.com> Date: Mon, 3 May 2021 13:35:03 +0200 Subject: [PATCH 2/3] Improve import Use Qt.IsPySide2 / Qt.IsPyQt5 rather than try/except --- NodeGraphQt/widgets/viewer.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/NodeGraphQt/widgets/viewer.py b/NodeGraphQt/widgets/viewer.py index 9c5b9af1..4168e617 100644 --- a/NodeGraphQt/widgets/viewer.py +++ b/NodeGraphQt/widgets/viewer.py @@ -2,11 +2,13 @@ # -*- coding: utf-8 -*- import math +import Qt from Qt import QtGui, QtCore, QtWidgets -try: +# use QOpenGLWidget instead of the deprecated QGLWdiegt to avoid probelms with Wayland +if Qt.IsPySide2: from PySide2.QtWidgets import QOpenGLWidget -except Exception: +elif Qt.IsPyQt5: from PyQt5.QtWidgets import QOpenGLWidget from .dialogs import BaseDialog, FileDialog From ba6edeb6c3f9dc4f6f9255b637861b1533935f99 Mon Sep 17 00:00:00 2001 From: mara004 <65915611+mara004@users.noreply.github.com> Date: Mon, 3 May 2021 15:44:10 +0200 Subject: [PATCH 3/3] Fix typo pardon --- NodeGraphQt/widgets/viewer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NodeGraphQt/widgets/viewer.py b/NodeGraphQt/widgets/viewer.py index 4168e617..5594797f 100644 --- a/NodeGraphQt/widgets/viewer.py +++ b/NodeGraphQt/widgets/viewer.py @@ -5,7 +5,7 @@ import Qt from Qt import QtGui, QtCore, QtWidgets -# use QOpenGLWidget instead of the deprecated QGLWdiegt to avoid probelms with Wayland +# use QOpenGLWidget instead of the deprecated QGLWidget to avoid probelms with Wayland if Qt.IsPySide2: from PySide2.QtWidgets import QOpenGLWidget elif Qt.IsPyQt5: