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
qopenglversionprofile.cpp
Go to the documentation of this file.
1// Copyright (C) 2020 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
5
6#include <QtCore/QDebug>
7
9
23
45
52{
53 d->majorVersion = format.majorVersion();
54 d->minorVersion = format.minorVersion();
55 d->profile = format.profile();
56}
57
66
74
79{
80 if (this == &rhs)
81 return *this;
82 *d = *(rhs.d);
83 return *this;
84}
85
92QPair<int, int> QOpenGLVersionProfile::version() const
93{
94 return qMakePair( d->majorVersion, d->minorVersion);
95}
96
102void QOpenGLVersionProfile::setVersion(int majorVersion, int minorVersion)
103{
104 d->majorVersion = majorVersion;
105 d->minorVersion = minorVersion;
106}
107
117
128
136{
137 return ( d->majorVersion > 3
138 || (d->majorVersion == 3 && d->minorVersion > 1));
139}
140
146{
147 return (d->majorVersion < 3 || (d->majorVersion == 3 && d->minorVersion == 0));
148}
149
157{
158 return d->majorVersion > 0 && d->minorVersion >= 0;
159}
160
161#ifndef QT_NO_DEBUG_STREAM
163{
164 QDebugStateSaver saver(debug);
165 debug.nospace();
166 debug << "QOpenGLVersionProfile(";
167 if (vp.isValid()) {
168 debug << vp.version().first << '.' << vp.version().second
169 << ", profile=" << vp.profile();
170 } else {
171 debug << "invalid";
172 }
173 debug << ')';
174 return debug;
175}
176
177#endif // QT_NO_DEBUG_STREAM
\inmodule QtCore
\inmodule QtCore
QSurfaceFormat::OpenGLContextProfile profile
void setProfile(QSurfaceFormat::OpenGLContextProfile profile)
Sets the OpenGL profile profile.
~QOpenGLVersionProfile()
Destroys the QOpenGLVersionProfile object.
void setVersion(int majorVersion, int minorVersion)
Sets the major and minor version numbers to majorVersion and minorVersion respectively.
QSurfaceFormat::OpenGLContextProfile profile() const
Returns the OpenGL profile.
bool isValid() const
Returns true if the version number is valid.
QOpenGLVersionProfile()
Creates a default invalid QOpenGLVersionProfile object.
bool isLegacyVersion() const
Returns true is the OpenGL version returned by version() contains deprecated functions and does not s...
QOpenGLVersionProfile & operator=(const QOpenGLVersionProfile &rhs)
Assigns the version and profile of rhs to this QOpenGLVersionProfile object.
bool hasProfiles() const
Returns true if profiles are supported by the OpenGL version returned by version().
QPair< int, int > version() const
Returns a QPair<int,int> where the components represent the major and minor OpenGL version numbers re...
The QSurfaceFormat class represents the format of a QSurface. \inmodule QtGui.
OpenGLContextProfile
This enum is used to specify the OpenGL context profile, in conjunction with QSurfaceFormat::setMajor...
Combined button and popup list for selecting options.
GLint GLsizei GLsizei GLenum format
QDebug operator<<(QDebug debug, const QOpenGLVersionProfile &vp)
QT_BEGIN_NAMESPACE constexpr decltype(auto) qMakePair(T1 &&value1, T2 &&value2) noexcept(noexcept(std::make_pair(std::forward< T1 >(value1), std::forward< T2 >(value2))))
Definition qpair.h:19
QSharedPointer< T > other(t)
[5]