From 22e439141384f49028770d2410fafb18ef8cad1f Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 7 Aug 2014 16:45:05 +0200 Subject: Add default format to QSurfaceFormat Add defaultFormat() and setDefaultFormat() statics to QSurfaceFormat. These define the default values for the requestedFormat members of QOpenGLContext, QWindow and QOpenGLWidget (and implicitly QOpenGLWindow, QQuickWindow, etc.) This replaces QQuickWindow::setDefaultFormat() which can now be removed. The main inspiration here is not the convenience (avoiding setFormat() calls for all windows/widgets), but robustness: by setting the format once at the start of the application, all windows and contexts, including the internal share context used by QOpenGLWidget and QQuickWidget, will use the same format, eliminating the possibility of failing due to trying to share between incompatible contexts. Furthermore, since such a functionality is anyway mandatory for QQuickWindow (due to the possibility of creating windows from QML code), extending it to QSurfaceFormat and QOpenGLContext/QWindow is the next logical step. Change-Id: Ie94486adc489d17fecfcebb7050fecedffd2688b Reviewed-by: Gunnar Sletta --- src/gui/kernel/qsurfaceformat.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/gui/kernel/qsurfaceformat.h') diff --git a/src/gui/kernel/qsurfaceformat.h b/src/gui/kernel/qsurfaceformat.h index 453beac5cd..05aba2f83c 100644 --- a/src/gui/kernel/qsurfaceformat.h +++ b/src/gui/kernel/qsurfaceformat.h @@ -138,6 +138,9 @@ public: int swapInterval() const; void setSwapInterval(int interval); + static void setDefaultFormat(const QSurfaceFormat &format); + static QSurfaceFormat defaultFormat(); + private: QSurfaceFormatPrivate *d; -- cgit v1.2.3