qmlscene: Simplify context sharing logic.
authorPierre Rossi <pierre.rossi@digia.com>
Tue, 28 Oct 2014 14:40:49 +0000 (15:40 +0100)
committerPierre Rossi <pierre.rossi@gmail.com>
Fri, 7 Nov 2014 16:24:26 +0000 (17:24 +0100)
We can use the new application attribute for this now.

Change-Id: Ia0a6d13d36316ec9becfb5d3251b8461ac73a2d0
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
tools/qmlscene/main.cpp

index bc339ae..2a86b72 100644 (file)
@@ -405,6 +405,9 @@ int main(int argc, char ** argv)
         }
     }
 
+    // QtWebEngine needs a shared context in order for the GPU thread to
+    // upload textures.
+    QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, options.contextSharing);
 #ifdef QT_WIDGETS_LIB
     QApplication app(argc, argv);
 #else
@@ -443,15 +446,6 @@ int main(int argc, char ** argv)
         displayFileDialog(&options);
 #endif
 
-    // QWebEngine needs a shared context in order for the GPU thread to
-    // upload textures.
-    QScopedPointer<QOpenGLContext> shareContext;
-    if (options.contextSharing) {
-        shareContext.reset(new QOpenGLContext);
-        shareContext->create();
-        qt_gl_set_global_share_context(shareContext.data());
-    }
-
     int exitCode = 0;
 
     if (!options.file.isEmpty()) {