Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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/qobjectdefs.h>
8
9QT_BEGIN_NAMESPACE
10
11class QColorSpace;
12class QOpenGLContext;
14
15class Q_GUI_EXPORT QSurfaceFormat
16{
17 Q_GADGET
18public:
19 enum FormatOption {
20 StereoBuffers = 0x0001,
21 DebugContext = 0x0002,
22 DeprecatedFunctions = 0x0004,
23 ResetNotification = 0x0008,
24 ProtectedContent = 0x0010
25 };
26 Q_ENUM(FormatOption)
27 Q_DECLARE_FLAGS(FormatOptions, FormatOption)
28
29 enum SwapBehavior {
30 DefaultSwapBehavior,
31 SingleBuffer,
32 DoubleBuffer,
33 TripleBuffer
34 };
35 Q_ENUM(SwapBehavior)
36
37 enum RenderableType {
38 DefaultRenderableType = 0x0,
39 OpenGL = 0x1,
40 OpenGLES = 0x2,
41 OpenVG = 0x4
42 };
43 Q_ENUM(RenderableType)
44
45 enum OpenGLContextProfile {
46 NoProfile,
47 CoreProfile,
48 CompatibilityProfile
49 };
50 Q_ENUM(OpenGLContextProfile)
51
52#if QT_DEPRECATED_SINCE(6,0)
53 enum ColorSpace {
54 DefaultColorSpace,
55 sRGBColorSpace
56 };
57 Q_ENUM(ColorSpace)
58#endif
59
60 enum ColorComponentType {
61 FixedColorComponentType,
62 FloatColorComponentType
63 };
64 Q_ENUM(ColorComponentType)
65
66 QSurfaceFormat();
67 Q_IMPLICIT QSurfaceFormat(FormatOptions options);
68 QSurfaceFormat(const QSurfaceFormat &other);
69 QSurfaceFormat &operator=(const QSurfaceFormat &other);
70 ~QSurfaceFormat();
71
72 void setDepthBufferSize(int size);
73 int depthBufferSize() const;
74
75 void setStencilBufferSize(int size);
76 int stencilBufferSize() const;
77
78 void setRedBufferSize(int size);
79 int redBufferSize() const;
80 void setGreenBufferSize(int size);
81 int greenBufferSize() const;
82 void setBlueBufferSize(int size);
83 int blueBufferSize() const;
84 void setAlphaBufferSize(int size);
85 int alphaBufferSize() const;
86
87 void setColorComponentType(ColorComponentType type);
88 ColorComponentType colorComponentType() const;
89
90 void setSamples(int numSamples);
91 int samples() const;
92
93 void setSwapBehavior(SwapBehavior behavior);
94 SwapBehavior swapBehavior() const;
95
96 bool hasAlpha() const;
97
98 void setProfile(OpenGLContextProfile profile);
99 OpenGLContextProfile profile() const;
100
101 void setRenderableType(RenderableType type);
102 RenderableType renderableType() const;
103
104 void setMajorVersion(int majorVersion);
105 int majorVersion() const;
106
107 void setMinorVersion(int minorVersion);
108 int minorVersion() const;
109
110 std::pair<int, int> version() const;
111 void setVersion(int major, int minor);
112
113 bool stereo() const;
114 void setStereo(bool enable);
115
116 void setOptions(QSurfaceFormat::FormatOptions options);
117 void setOption(FormatOption option, bool on = true);
118 bool testOption(FormatOption option) const;
119 QSurfaceFormat::FormatOptions options() const;
120
121 int swapInterval() const;
122 void setSwapInterval(int interval);
123
124 const QColorSpace &colorSpace() const;
125 void setColorSpace(const QColorSpace &colorSpace);
126#if QT_DEPRECATED_SINCE(6,0)
127 Q_DECL_DEPRECATED_X("Use setColorSpace(QColorSpace) instead.")
128 void setColorSpace(ColorSpace colorSpace);
129#endif
130
131 static void setDefaultFormat(const QSurfaceFormat &format);
132 static QSurfaceFormat defaultFormat();
133
134private:
135 QSurfaceFormatPrivate *d;
136
137 void detach();
138 bool equals(const QSurfaceFormat &other) const noexcept;
139
140 friend inline bool operator==(const QSurfaceFormat &lhs, const QSurfaceFormat &rhs) noexcept
141 { return lhs.equals(rhs); }
142 friend inline bool operator!=(const QSurfaceFormat &lhs, const QSurfaceFormat &rhs) noexcept
143 { return !lhs.equals(rhs); }
144#ifndef QT_NO_DEBUG_STREAM
145 friend Q_GUI_EXPORT QDebug operator<<(QDebug, const QSurfaceFormat &);
146#endif
147};
148
149#ifndef QT_NO_DEBUG_STREAM
150Q_GUI_EXPORT QDebug operator<<(QDebug, const QSurfaceFormat &);
151#endif
152
153Q_DECLARE_OPERATORS_FOR_FLAGS(QSurfaceFormat::FormatOptions)
154
155inline bool QSurfaceFormat::stereo() const
156{
157 return testOption(QSurfaceFormat::StereoBuffers);
158}
159
160QT_END_NAMESPACE
161
162#endif //QSURFACEFORMAT_H
QSurfaceFormatPrivate(QSurfaceFormat::FormatOptions _opts={ })
QSurfaceFormatPrivate(const QSurfaceFormatPrivate *other)
The QSurfaceFormat class represents the format of a QSurface. \inmodule QtGui.
Q_GLOBAL_STATIC(DefaultRoleNames, qDefaultRoleNames, { { Qt::DisplayRole, "display" }, { Qt::DecorationRole, "decoration" }, { Qt::EditRole, "edit" }, { Qt::ToolTipRole, "toolTip" }, { Qt::StatusTipRole, "statusTip" }, { Qt::WhatsThisRole, "whatsThis" }, }) const QHash< int
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
Definition qdir.cpp:2568
QDebug operator<<(QDebug dbg, const QFileInfo &fi)