Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qsurfaceformat.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3#ifndef QSURFACEFORMAT_H
4#define QSURFACEFORMAT_H
5
6#include <QtGui/qtguiglobal.h>
7#include <QtCore/qpair.h>
8#include <QtCore/qobjectdefs.h>
9
11
12class QColorSpace;
13class QOpenGLContext;
15
16class Q_GUI_EXPORT QSurfaceFormat
17{
19public:
21 StereoBuffers = 0x0001,
22 DebugContext = 0x0002,
23 DeprecatedFunctions = 0x0004,
24 ResetNotification = 0x0008,
25 ProtectedContent = 0x0010
26 };
27 Q_ENUM(FormatOption)
28 Q_DECLARE_FLAGS(FormatOptions, FormatOption)
29
36 Q_ENUM(SwapBehavior)
37
39 DefaultRenderableType = 0x0,
40 OpenGL = 0x1,
41 OpenGLES = 0x2,
42 OpenVG = 0x4
43 };
44 Q_ENUM(RenderableType)
45
49 CompatibilityProfile
50 };
51 Q_ENUM(OpenGLContextProfile)
52
53#if QT_DEPRECATED_SINCE(6,0)
54 enum ColorSpace {
55 DefaultColorSpace,
56 sRGBColorSpace
57 };
58 Q_ENUM(ColorSpace)
59#endif
60
62 Q_IMPLICIT QSurfaceFormat(FormatOptions options);
64 QSurfaceFormat &operator=(const QSurfaceFormat &other);
66
67 void setDepthBufferSize(int size);
68 int depthBufferSize() const;
69
70 void setStencilBufferSize(int size);
71 int stencilBufferSize() const;
72
73 void setRedBufferSize(int size);
74 int redBufferSize() const;
75 void setGreenBufferSize(int size);
76 int greenBufferSize() const;
77 void setBlueBufferSize(int size);
78 int blueBufferSize() const;
79 void setAlphaBufferSize(int size);
80 int alphaBufferSize() const;
81
82 void setSamples(int numSamples);
83 int samples() const;
84
85 void setSwapBehavior(SwapBehavior behavior);
86 SwapBehavior swapBehavior() const;
87
88 bool hasAlpha() const;
89
90 void setProfile(OpenGLContextProfile profile);
91 OpenGLContextProfile profile() const;
92
93 void setRenderableType(RenderableType type);
94 RenderableType renderableType() const;
95
96 void setMajorVersion(int majorVersion);
97 int majorVersion() const;
98
99 void setMinorVersion(int minorVersion);
100 int minorVersion() const;
101
102 QPair<int, int> version() const;
103 void setVersion(int major, int minor);
104
105 bool stereo() const;
106 void setStereo(bool enable);
107
108 void setOptions(QSurfaceFormat::FormatOptions options);
109 void setOption(FormatOption option, bool on = true);
110 bool testOption(FormatOption option) const;
111 QSurfaceFormat::FormatOptions options() const;
112
113 int swapInterval() const;
114 void setSwapInterval(int interval);
115
116 const QColorSpace &colorSpace() const;
117 void setColorSpace(const QColorSpace &colorSpace);
118#if QT_DEPRECATED_SINCE(6,0)
119 Q_DECL_DEPRECATED_X("Use setColorSpace(QColorSpace) instead.")
120 void setColorSpace(ColorSpace colorSpace);
121#endif
122
123 static void setDefaultFormat(const QSurfaceFormat &format);
124 static QSurfaceFormat defaultFormat();
125
126private:
128
129 void detach();
130 bool equals(const QSurfaceFormat &other) const noexcept;
131
132 friend inline bool operator==(const QSurfaceFormat &lhs, const QSurfaceFormat &rhs) noexcept
133 { return lhs.equals(rhs); }
134 friend inline bool operator!=(const QSurfaceFormat &lhs, const QSurfaceFormat &rhs) noexcept
135 { return !lhs.equals(rhs); }
136#ifndef QT_NO_DEBUG_STREAM
137 friend Q_GUI_EXPORT QDebug operator<<(QDebug, const QSurfaceFormat &);
138#endif
139};
140
141#ifndef QT_NO_DEBUG_STREAM
142Q_GUI_EXPORT QDebug operator<<(QDebug, const QSurfaceFormat &);
143#endif
144
145Q_DECLARE_OPERATORS_FOR_FLAGS(QSurfaceFormat::FormatOptions)
146
147inline bool QSurfaceFormat::stereo() const
148{
149 return testOption(QSurfaceFormat::StereoBuffers);
150}
151
153
154#endif //QSURFACEFORMAT_H
The QColorSpace class provides a color space abstraction.
Definition qcolorspace.h:21
\inmodule QtCore
\inmodule QtGui
The QSurfaceFormat class represents the format of a QSurface. \inmodule QtGui.
friend bool operator!=(const QSurfaceFormat &lhs, const QSurfaceFormat &rhs) noexcept
Returns false if all the options of the two QSurfaceFormat objects lhs and rhs are equal; otherwise r...
SwapBehavior
This enum is used by QSurfaceFormat to specify the swap behaviour of a surface.
RenderableType
This enum specifies the rendering backend for the surface.
Q_IMPLICIT QSurfaceFormat(FormatOptions options)
OpenGLContextProfile
This enum is used to specify the OpenGL context profile, in conjunction with QSurfaceFormat::setMajor...
friend bool operator==(const QSurfaceFormat &lhs, const QSurfaceFormat &rhs) noexcept
Returns true if all the options of the two QSurfaceFormat objects lhs and rhs are equal.
FormatOption
This enum contains format options for use with QSurfaceFormat.
format setVersion(3, 2)
format setDepthBufferSize(24)
format setProfile(QSurfaceFormat::CoreProfile)
format setStencilBufferSize(8)
Combined button and popup list for selecting options.
#define Q_DECL_DEPRECATED_X(text)
#define Q_IMPLICIT
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition qflags.h:174
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
Definition qflags.h:194
GLsizei samples
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum type
GLboolean enable
GLint GLsizei GLsizei GLenum format
GLuint GLenum option
static bool hasAlpha(const QImage &image)
Q_GUI_EXPORT QDebug operator<<(QDebug, const QSurfaceFormat &)
#define Q_ENUM(x)
#define Q_GADGET
QDataStream & operator<<(QDataStream &out, const MyClass &myObj)
[4]
QSharedPointer< T > other(t)
[5]