summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qevent.cpp9
-rw-r--r--src/gui/kernel/qguiapplication.cpp25
-rw-r--r--src/gui/kernel/qopenglcontext.cpp142
-rw-r--r--src/gui/kernel/qopenglcontext.h12
-rw-r--r--src/gui/kernel/qpalette.h3
-rw-r--r--src/gui/kernel/qplatformintegration.cpp34
-rw-r--r--src/gui/kernel/qplatformintegration.h9
-rw-r--r--src/gui/kernel/qplatformtheme.cpp2
-rw-r--r--src/gui/kernel/qplatformtheme.h3
-rw-r--r--src/gui/kernel/qsimpledrag.cpp10
-rw-r--r--src/gui/kernel/qtouchdevice.cpp2
-rw-r--r--src/gui/kernel/qwindow.cpp14
12 files changed, 216 insertions, 49 deletions
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 7759e812cb..295380a93c 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -3295,11 +3295,14 @@ QDebug operator<<(QDebug dbg, const QEvent *e) {
n = "MouseButtonDblClick";
break;
}
- dbg.nospace() << "QMouseEvent(" << n
+ QDebug nsp = dbg.nospace();
+ nsp << "QMouseEvent(" << n
<< ", " << me->button()
<< ", " << hex << (int)me->buttons()
- << ", " << hex << (int)me->modifiers()
- << ')';
+ << ", " << hex << (int)me->modifiers() << dec;
+ if (const Qt::MouseEventSource source = me->source())
+ nsp << ", source = " << source;
+ nsp << ')';
}
return dbg.space();
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index c587e51299..c6376b2647 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -145,7 +145,7 @@ ulong QGuiApplicationPrivate::mousePressTime = 0;
Qt::MouseButton QGuiApplicationPrivate::mousePressButton = Qt::NoButton;
int QGuiApplicationPrivate::mousePressX = 0;
int QGuiApplicationPrivate::mousePressY = 0;
-int QGuiApplicationPrivate::mouse_double_click_distance = 5;
+int QGuiApplicationPrivate::mouse_double_click_distance = -1;
static Qt::LayoutDirection layout_direction = Qt::LeftToRight;
static bool force_reverse = false;
@@ -910,7 +910,7 @@ qreal QGuiApplication::devicePixelRatio() const
}
/*!
- Returns the top level window at the given position, if any.
+ Returns the top level window at the given position \a pos, if any.
*/
QWindow *QGuiApplication::topLevelAt(const QPoint &pos)
{
@@ -1007,16 +1007,17 @@ static void init_platform(const QString &pluginArgument, const QString &platform
if (!platformThemeName.isEmpty())
themeNames.append(platformThemeName);
- // 2) Ask the platform integration for a list of names and try loading them.
+ // 2) Ask the platform integration for a list of theme names
themeNames += QGuiApplicationPrivate::platform_integration->themeNames();
+ // 3) Look for a theme plugin.
foreach (const QString &themeName, themeNames) {
QGuiApplicationPrivate::platform_theme = QPlatformThemeFactory::create(themeName, platformPluginPath);
if (QGuiApplicationPrivate::platform_theme)
break;
}
- // 3) If none found, look for a theme plugin. Theme plugins are located in the
- // same directory as platform plugins.
+ // 4) If no theme plugin was found ask the platform integration to
+ // create a theme
if (!QGuiApplicationPrivate::platform_theme) {
foreach (const QString &themeName, themeNames) {
QGuiApplicationPrivate::platform_theme = QGuiApplicationPrivate::platform_integration->createPlatformTheme(themeName);
@@ -1026,7 +1027,7 @@ static void init_platform(const QString &pluginArgument, const QString &platform
// No error message; not having a theme plugin is allowed.
}
- // 4) Fall back on the built-in "null" platform theme.
+ // 5) Fall back on the built-in "null" platform theme.
if (!QGuiApplicationPrivate::platform_theme)
QGuiApplicationPrivate::platform_theme = new QPlatformTheme;
@@ -1254,6 +1255,8 @@ void QGuiApplicationPrivate::init()
initPalette();
QFont::initialize();
+ mouse_double_click_distance = platformTheme()->themeHint(QPlatformTheme::MouseDoubleClickDistance).toInt();
+
#ifndef QT_NO_CURSOR
QCursorData::initialize();
#endif
@@ -2708,7 +2711,7 @@ void QGuiApplicationPrivate::notifyWindowIconChanged()
\brief whether the application implicitly quits when the last window is
closed.
- The default is true.
+ The default is \c true.
If this property is \c true, the applications quits when the last visible
primary window (i.e. window with no parent) is closed.
@@ -2736,7 +2739,7 @@ bool QGuiApplication::quitOnLastWindowClosed()
primary window (i.e. window with no parent) is closed.
By default, QGuiApplication quits after this signal is emitted. This feature
- can be turned off by setting \l quitOnLastWindowClosed to false.
+ can be turned off by setting \l quitOnLastWindowClosed to \c false.
\sa QWindow::close(), QWindow::isTopLevel()
*/
@@ -2912,7 +2915,7 @@ void QGuiApplicationPrivate::setApplicationState(Qt::ApplicationState state)
Returns \c true if the application is currently saving the
\l{Session Management}{session}; otherwise returns \c false.
- This is true when commitDataRequest() and saveStateRequest() are emitted,
+ This is \c true when commitDataRequest() and saveStateRequest() are emitted,
but also when the windows are closed afterwards by session management.
\sa sessionId(), commitDataRequest(), saveStateRequest()
@@ -3183,7 +3186,7 @@ QStyleHints *QGuiApplication::styleHints()
/*!
Sets whether Qt should use the system's standard colors, fonts, etc., to
- \a on. By default, this is true.
+ \a on. By default, this is \c true.
This function must be called before creating the QGuiApplication object, like
this:
@@ -3199,7 +3202,7 @@ void QGuiApplication::setDesktopSettingsAware(bool on)
/*!
Returns \c true if Qt is set to use the system's standard colors, fonts, etc.;
- otherwise returns \c false. The default is true.
+ otherwise returns \c false. The default is \c true.
\sa setDesktopSettingsAware()
*/
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index 7257663799..fb7d15c160 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.cpp
@@ -52,6 +52,7 @@
#include <QtGui/private/qopengl_p.h>
#include <QtGui/private/qwindow_p.h>
#include <QtGui/QScreen>
+#include <qpa/qplatformnativeinterface.h>
#include <private/qopenglextensions_p.h>
#include <private/qopenglversionfunctionsfactory_p.h>
@@ -162,7 +163,7 @@ void QOpenGLVersionProfile::setVersion(int majorVersion, int minorVersion)
}
/*!
- Returns the OpenGL profile. Only make sense if profiles are supported by this version.
+ Returns the OpenGL profile. Only makes sense if profiles are supported by this version.
\sa setProfile(), supportsProfiles()
*/
@@ -172,7 +173,8 @@ QSurfaceFormat::OpenGLContextProfile QOpenGLVersionProfile::profile() const
}
/*!
- Sets the profile. Only make sense if profiles are supported by this version.
+ Sets the OpenGL profile \a profile. Only makes sense if profiles are supported by
+ this version.
\sa profile(), supportsProfiles()
*/
@@ -204,7 +206,7 @@ bool QOpenGLVersionProfile::isLegacyVersion() const
/*!
Returns \c true if the version number is valid. Note that for a default constructed
- QOpenGLVersionProfile object this function will return false.
+ QOpenGLVersionProfile object this function will return \c false.
\sa setVersion(), version()
*/
@@ -256,12 +258,10 @@ QMutex QOpenGLContextPrivate::makeCurrentTrackerMutex;
rendering a new frame, after calling swapBuffers().
If the context is temporarily not needed, such as when the application is
- not rendering, it can be useful to call destroy() to free resources.
- However, if you do so you will need to call create() again before the
- context can be used, and you might need to recreate any OpenGL resources
- and reinitialize the OpenGL state. You can connect to the
- aboutToBeDestroyed() signal to clean up any resources that have been
- allocated with different ownership from the QOpenGLContext itself.
+ not rendering, it can be useful to delete it in order to free resources.
+ You can connect to the aboutToBeDestroyed() signal to clean up any
+ resources that have been allocated with different ownership from the
+ QOpenGLContext itself.
Once a QOpenGLContext has been made current, you can render to it in a
platform independent way by using Qt's OpenGL enablers such as
@@ -335,16 +335,18 @@ int QOpenGLContextPrivate::maxTextureSize()
if (max_texture_size != -1)
return max_texture_size;
- glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size);
+ Q_Q(QOpenGLContext);
+ QOpenGLFunctions *funcs = q->functions();
+ funcs->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size);
#ifndef QT_OPENGL_ES
- if (!QOpenGLFunctions::isES()) {
+ if (!q->isES()) {
GLenum proxy = GL_PROXY_TEXTURE_2D;
GLint size;
GLint next = 64;
- glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
- glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &size);
+ funcs->glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
+ funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &size);
if (size == 0) {
return max_texture_size;
}
@@ -354,8 +356,8 @@ int QOpenGLContextPrivate::maxTextureSize()
if (next > max_texture_size)
break;
- glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
- glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &next);
+ funcs->glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
+ funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &next);
} while (next > size);
max_texture_size = size;
@@ -633,9 +635,9 @@ QOpenGLFunctions *QOpenGLContext::functions() const
*/
/*!
- Returns a pointer to an object that provides access to all functions for
- the version of the current context. Before using any of the functions
- they must be initialized by calling QAbstractOpenGLFunctions::initializeOpenGLFunctions().
+ Returns a pointer to an object that provides access to all functions for the
+ \a versionProfile of the current context. Before using any of the functions they must
+ be initialized by calling QAbstractOpenGLFunctions::initializeOpenGLFunctions().
Usually one would use the template version of this function to automatically
have the result cast to the correct type.
@@ -643,8 +645,8 @@ QOpenGLFunctions *QOpenGLContext::functions() const
QAbstractOpenGLFunctions *QOpenGLContext::versionFunctions(const QOpenGLVersionProfile &versionProfile) const
{
#ifndef QT_OPENGL_ES_2
- if (QOpenGLFunctions::isES()) {
- qWarning("versionFunctions: Not supported on dynamic GL ES");
+ if (isES()) {
+ qWarning("versionFunctions: Not supported on OpenGL ES");
return 0;
}
#endif // QT_OPENGL_ES_2
@@ -703,7 +705,7 @@ QSet<QByteArray> QOpenGLContext::extensions() const
/*!
Returns \c true if this OpenGL context supports the specified OpenGL
- \a extension, false otherwise.
+ \a extension, \c false otherwise.
The context or a sharing context must be current.
@@ -864,7 +866,7 @@ void QOpenGLContext::swapBuffers(QSurface *surface)
qWarning() << "QOpenGLContext::swapBuffers() called without corresponding makeCurrent()";
#endif
if (surface->format().swapBehavior() == QSurfaceFormat::SingleBuffer)
- glFlush();
+ functions()->glFlush();
d->platformGLContext->swapBuffers(surfaceHandle);
}
@@ -885,6 +887,20 @@ QFunctionPointer QOpenGLContext::getProcAddress(const QByteArray &procName) cons
Returns the format of the underlying platform context, if create() has been called.
Otherwise, returns the requested format.
+
+ The requested and the actual format may differ. Requesting a given OpenGL version does
+ not mean the resulting context will target exactly the requested version. It is only
+ guaranteed that the version/profile/options combination for the created context is
+ compatible with the request, as long as the driver is able to provide such a context.
+
+ For example, requesting an OpenGL version 3.x core profile context may result in an
+ OpenGL 4.x core profile context. Similarly, a request for OpenGL 2.1 may result in an
+ OpenGL 3.0 context with deprecated functions enabled. Finally, depending on the
+ driver, unsupported versions may result in either a context creation failure or in a
+ context for the highest supported version.
+
+ Similar differences are possible in the buffer sizes, for example, the resulting
+ context may have a larger depth buffer than requested. This is perfectly normal.
*/
QSurfaceFormat QOpenGLContext::format() const
{
@@ -960,6 +976,88 @@ void QOpenGLContext::deleteQGLContext()
}
/*!
+ Returns the platform-specific handle for the OpenGL implementation that
+ is currently in use. (for example, a HMODULE on Windows)
+
+ On platforms that do not use dynamic GL switch the return value is null.
+
+ The library might be GL-only, meaning that windowing system interface
+ functions (for example EGL) may live in another, separate library.
+
+ \note This function requires that the QGuiApplication instance is already created.
+
+ \sa openGLModuleType()
+
+ \since 5.3
+ */
+void *QOpenGLContext::openGLModuleHandle()
+{
+#ifdef QT_OPENGL_DYNAMIC
+ QGuiApplication *app = qGuiApp;
+ Q_ASSERT(app);
+ return app->platformNativeInterface()->nativeResourceForIntegration(QByteArrayLiteral("glhandle"));
+#else
+ return 0;
+#endif
+}
+
+/*!
+ \enum QOpenGLContext::OpenGLModuleType
+ This enum defines the type of the underlying OpenGL implementation.
+
+ \value DesktopGL Desktop OpenGL
+ \value GLES2 OpenGL ES 2.0 or higher
+ \value GLES1 OpenGL ES 1.x
+
+ \since 5.3
+*/
+
+/*!
+ Returns the underlying OpenGL implementation type.
+
+ On platforms where the OpenGL implementation is not dynamically
+ loaded, the return value is determined during compile time and never
+ changes.
+
+ \note A desktop OpenGL implementation may be capable of creating
+ ES-compatible contexts too. Therefore in most cases it is more
+ appropriate to check QSurfaceFormat::renderableType() or using the
+ the convenience function isES().
+
+ \note This function requires that the QGuiApplication instance is already created.
+
+ \since 5.3
+ */
+QOpenGLContext::OpenGLModuleType QOpenGLContext::openGLModuleType()
+{
+#if defined(QT_OPENGL_DYNAMIC)
+ Q_ASSERT(qGuiApp);
+ return QGuiApplicationPrivate::instance()->platformIntegration()->openGLModuleType();
+#elif defined(QT_OPENGL_ES_2)
+ return GLES2;
+#elif defined(QT_OPENGL_ES)
+ return GLES1;
+#else
+ return DesktopGL;
+#endif
+}
+
+/*!
+ Returns true if the context is an OpenGL ES context.
+
+ If the context has not yet been created, the result is based on the
+ requested format set via setFormat().
+
+ \sa create(), format(), setFormat()
+
+ \since 5.3
+ */
+bool QOpenGLContext::isES() const
+{
+ return format().renderableType() == QSurfaceFormat::OpenGLES;
+}
+
+/*!
\internal
*/
QOpenGLVersionFunctionsBackend *QOpenGLContext::functionsBackend(const QOpenGLVersionStatus &v) const
diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h
index ce34a2d5a5..06a7b723b4 100644
--- a/src/gui/kernel/qopenglcontext.h
+++ b/src/gui/kernel/qopenglcontext.h
@@ -192,6 +192,18 @@ public:
QSet<QByteArray> extensions() const;
bool hasExtension(const QByteArray &extension) const;
+ static void *openGLModuleHandle();
+
+ enum OpenGLModuleType {
+ DesktopGL,
+ GLES2,
+ GLES1
+ };
+
+ static OpenGLModuleType openGLModuleType();
+
+ bool isES() const;
+
Q_SIGNALS:
void aboutToBeDestroyed();
diff --git a/src/gui/kernel/qpalette.h b/src/gui/kernel/qpalette.h
index 9abca30f12..8d9754d388 100644
--- a/src/gui/kernel/qpalette.h
+++ b/src/gui/kernel/qpalette.h
@@ -72,8 +72,7 @@ public:
#ifdef Q_COMPILER_RVALUE_REFS
inline QPalette &operator=(QPalette &&other)
{
- data.resolve_mask = other.data.resolve_mask;
- data.current_group = other.data.current_group;
+ for_faster_swapping_dont_use = other.for_faster_swapping_dont_use;
qSwap(d, other.d); return *this;
}
#endif
diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp
index bec201f3f7..a6e0d4705b 100644
--- a/src/gui/kernel/qplatformintegration.cpp
+++ b/src/gui/kernel/qplatformintegration.cpp
@@ -229,6 +229,16 @@ QPlatformServices *QPlatformIntegration::services() const
management. This includes the typical desktop platforms. Can be set to false on
platforms where no window management is available, meaning for example that windows
are never repositioned by the window manager. The default implementation returns \c true.
+
+ \value AllGLFunctionsQueryable The QOpenGLContext backend provided by the platform is
+ able to return function pointers from getProcAddress() even for standard OpenGL
+ functions, for example OpenGL 1 functions like glClear() or glDrawArrays(). This is
+ important because the OpenGL specifications do not require this ability from the
+ getProcAddress implementations of the windowing system interfaces (EGL, WGL, GLX). The
+ platform plugins may however choose to enhance the behavior in the backend
+ implementation for QOpenGLContext::getProcAddress() and support returning a function
+ pointer also for the standard, non-extension functions. This capability is a
+ prerequisite for dynamic OpenGL loading.
*/
/*!
@@ -465,7 +475,31 @@ QPlatformSessionManager *QPlatformIntegration::createPlatformSessionManager(cons
*/
void QPlatformIntegration::sync()
{
+}
+
+#ifndef QT_NO_OPENGL
+/*!
+ Platform integration function for querying the OpenGL implementation type.
+
+ Used only when dynamic OpenGL implementation loading is enabled.
+ Subclasses should reimplement this function and return a value based on
+ the OpenGL implementation they have chosen to load.
+
+ \note The return value does not indicate or limit the types of
+ contexts that can be created by a given implementation. For example
+ a desktop OpenGL implementation may be capable of creating OpenGL
+ ES-compatible contexts too.
+
+ \sa QOpenGLContext::openGLModuleType(), QOpenGLContext::isES()
+
+ \since 5.3
+ */
+QOpenGLContext::OpenGLModuleType QPlatformIntegration::openGLModuleType()
+{
+ qWarning("This plugin does not support dynamic OpenGL loading!");
+ return QOpenGLContext::DesktopGL;
}
+#endif
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h
index 35ef88949f..4804048fde 100644
--- a/src/gui/kernel/qplatformintegration.h
+++ b/src/gui/kernel/qplatformintegration.h
@@ -54,6 +54,7 @@
#include <QtGui/qwindowdefs.h>
#include <qpa/qplatformscreen.h>
#include <QtGui/qsurfaceformat.h>
+#include <QtGui/qopenglcontext.h>
QT_BEGIN_NAMESPACE
@@ -96,7 +97,8 @@ public:
NativeWidgets,
WindowManagement,
SyncState,
- RasterGLSurface
+ RasterGLSurface,
+ AllGLFunctionsQueryable
};
virtual ~QPlatformIntegration() { }
@@ -169,6 +171,11 @@ public:
#endif
virtual void sync();
+
+#ifndef QT_NO_OPENGL
+ virtual QOpenGLContext::OpenGLModuleType openGLModuleType();
+#endif
+
protected:
void screenAdded(QPlatformScreen *screen);
};
diff --git a/src/gui/kernel/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp
index e12eb318dc..05ab2f15ba 100644
--- a/src/gui/kernel/qplatformtheme.cpp
+++ b/src/gui/kernel/qplatformtheme.cpp
@@ -499,6 +499,8 @@ QVariant QPlatformTheme::defaultThemeHint(ThemeHint hint)
return QVariant(false);
case MousePressAndHoldInterval:
return QVariant(800);
+ case MouseDoubleClickDistance:
+ return QVariant(5);
}
return QVariant();
}
diff --git a/src/gui/kernel/qplatformtheme.h b/src/gui/kernel/qplatformtheme.h
index 205a5bab69..073eda8d07 100644
--- a/src/gui/kernel/qplatformtheme.h
+++ b/src/gui/kernel/qplatformtheme.h
@@ -108,7 +108,8 @@ public:
PasswordMaskCharacter,
DialogSnapToDefaultButton,
ContextMenuOnMouseRelease,
- MousePressAndHoldInterval
+ MousePressAndHoldInterval,
+ MouseDoubleClickDistance
};
enum DialogType {
diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp
index f6912a2d57..d53239e74f 100644
--- a/src/gui/kernel/qsimpledrag.cpp
+++ b/src/gui/kernel/qsimpledrag.cpp
@@ -116,6 +116,8 @@ void QBasicDrag::disableEventFilter()
bool QBasicDrag::eventFilter(QObject *o, QEvent *e)
{
+ Q_UNUSED(o);
+
if (!m_drag) {
if (e->type() == QEvent::KeyRelease && static_cast<QKeyEvent*>(e)->key() == Qt::Key_Escape) {
disableEventFilter();
@@ -125,9 +127,6 @@ bool QBasicDrag::eventFilter(QObject *o, QEvent *e)
return false;
}
- if (!qobject_cast<QWindow *>(o))
- return false;
-
switch (e->type()) {
case QEvent::ShortcutOverride:
// prevent accelerators from firing while dragging
@@ -324,9 +323,10 @@ void QSimpleDrag::startDrag()
void QSimpleDrag::cancel()
{
QBasicDrag::cancel();
- if (drag())
+ if (drag() && m_current_window) {
QWindowSystemInterface::handleDrag(m_current_window, 0, QPoint(), Qt::IgnoreAction);
- m_current_window = 0;
+ m_current_window = 0;
+ }
}
void QSimpleDrag::move(const QMouseEvent *me)
diff --git a/src/gui/kernel/qtouchdevice.cpp b/src/gui/kernel/qtouchdevice.cpp
index 3ad4b4161e..117f2c5e76 100644
--- a/src/gui/kernel/qtouchdevice.cpp
+++ b/src/gui/kernel/qtouchdevice.cpp
@@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QTouchDevice
- \brief The QTouchDevice class describes the device from with touch events originate.
+ \brief The QTouchDevice class describes the device from which touch events originate.
\since 5.0
\ingroup touch
\inmodule QtGui
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 04a2615c81..fd9e0ad61b 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -642,7 +642,7 @@ void QWindow::setFormat(const QSurfaceFormat &format)
}
/*!
- Returns the requested surfaceformat of this window.
+ Returns the requested surface format of this window.
If the requested format was not supported by the platform implementation,
the requestedFormat will differ from the actual window format.
@@ -662,9 +662,17 @@ QSurfaceFormat QWindow::requestedFormat() const
After the window has been created, this function will return the actual surface format
of the window. It might differ from the requested format if the requested format could
- not be fulfilled by the platform.
+ not be fulfilled by the platform. It might also be a superset, for example certain
+ buffer sizes may be larger than requested.
- \sa create(), requestedFormat()
+ \note Depending on the platform, certain values in this surface format may still
+ contain the requested values, that is, the values that have been passed to
+ setFormat(). Typical examples are the OpenGL version, profile and options. These may
+ not get updated during create() since these are context specific and a single window
+ may be used together with multiple contexts over its lifetime. Use the
+ QOpenGLContext's format() instead to query such values.
+
+ \sa create(), requestedFormat(), QOpenGLContext::format()
*/
QSurfaceFormat QWindow::format() const
{