diff options
Diffstat (limited to 'src/gui/kernel/qsurfaceformat.cpp')
-rw-r--r-- | src/gui/kernel/qsurfaceformat.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gui/kernel/qsurfaceformat.cpp b/src/gui/kernel/qsurfaceformat.cpp index d7dc0faceb..000d727380 100644 --- a/src/gui/kernel/qsurfaceformat.cpp +++ b/src/gui/kernel/qsurfaceformat.cpp @@ -41,6 +41,8 @@ #include <QtCore/qatomic.h> #include <QtCore/QDebug> +#include <QOpenGLContext> +#include <QtGui/qguiapplication.h> #ifdef major #undef major @@ -761,6 +763,16 @@ Q_GLOBAL_STATIC(QSurfaceFormat, qt_default_surface_format) */ void QSurfaceFormat::setDefaultFormat(const QSurfaceFormat &format) { +#ifndef QT_NO_OPENGL + if (qApp) { + QOpenGLContext *globalContext = QOpenGLContext::globalShareContext(); + if (globalContext && globalContext->isValid()) { + qWarning("Warning: Setting a new default format with a different version or profile " + "after the global shared context is created may cause issues with context " + "sharing."); + } + } +#endif *qt_default_surface_format() = format; } |