Permalink
Browse files

Set AA_ShareOpenGLContexts attribute, to fix WebEngine warning on Win…

…dows

Currently Qt WebEngine complains (as can be seen on appveyor):

  Qt WebEngine seems to be initialized from a plugin. Please set
  Qt::AA_ShareOpenGLContexts using QCoreApplication::setAttribute before
  constructing QGuiApplication.
  • Loading branch information...
mitya57 committed Jan 23, 2017
1 parent 43298d9 commit a64107394c6f1c97f8d2d6fe1709c45c3a62fc41
Showing with 11 additions and 2 deletions.
  1. +4 −1 retext.py
  2. +2 −0 tests/test_editor.py
  3. +2 −0 tests/test_settings.py
  4. +3 −1 tests/test_window.py
View
@@ -28,7 +28,7 @@
from ReText.window import ReTextWindow
from PyQt5.QtCore import QFile, QFileInfo, QIODevice, QLibraryInfo, \
- QTextStream, QTranslator
+ QTextStream, QTranslator, Qt
from PyQt5.QtWidgets import QApplication
from PyQt5.QtNetwork import QNetworkProxyFactory
@@ -47,6 +47,9 @@ def main():
sys.stdout = open(devnull, 'w')
sys.stderr = open('stderr.log', 'w')
+ if hasattr(Qt, 'AA_ShareOpenGLContexts'):
+ # Needed for Qt WebEngine on Windows
+ QApplication.setAttribute(Qt.AA_ShareOpenGLContexts)
app = QApplication(sys.argv)
app.setOrganizationName("ReText project")
app.setApplicationName("ReText")
View
@@ -27,6 +27,8 @@
from PyQt5.QtWidgets import QApplication
from markups import MarkdownMarkup, ReStructuredTextMarkup
+if hasattr(Qt, 'AA_ShareOpenGLContexts'):
+ QApplication.setAttribute(Qt.AA_ShareOpenGLContexts)
# Keep a reference so it is not garbage collected
app = QApplication.instance() or QApplication(sys.argv)
View
@@ -30,6 +30,8 @@
# only have one QCoreApplication instance for all tests in a process. As
# other tests need QApplication, we should not create a bare QCoreApplication
# here. Also, keep a reference so it is not garbage collected.
+if hasattr(Qt, 'AA_ShareOpenGLContexts'):
+ QApplication.setAttribute(Qt.AA_ShareOpenGLContexts)
app = QApplication.instance() or QApplication(sys.argv)
class TestSettings(unittest.TestCase):
View
@@ -28,14 +28,16 @@
from markups.abstract import ConvertedMarkup
-from PyQt5.QtCore import pyqtSignal, QObject
+from PyQt5.QtCore import pyqtSignal, QObject, Qt
from PyQt5.QtWidgets import QApplication
import ReText
from ReText.window import ReTextWindow
defaultEventTimeout = 0.0
path_to_testdata = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'testdata')
+if hasattr(Qt, 'AA_ShareOpenGLContexts'):
+ QApplication.setAttribute(Qt.AA_ShareOpenGLContexts)
app = QApplication.instance() or QApplication(sys.argv)
ReText.initializeDataDirs()

0 comments on commit a641073

Please sign in to comment.