File indexing completed on 2025-02-21 10:12:18
0001
0002
0003
0004 #ifndef QOPENGLVERSIONPROFILE_H
0005 #define QOPENGLVERSIONPROFILE_H
0006
0007 #include <QtOpenGL/qtopenglglobal.h>
0008
0009 #include <QtGui/QSurfaceFormat>
0010
0011 #include <QtCore/QPair>
0012 #include <QtCore/qhashfunctions.h>
0013
0014 QT_BEGIN_NAMESPACE
0015
0016 class QOpenGLVersionProfilePrivate;
0017 class QDebug;
0018
0019 class Q_OPENGL_EXPORT QOpenGLVersionProfile
0020 {
0021 public:
0022 QOpenGLVersionProfile();
0023 explicit QOpenGLVersionProfile(const QSurfaceFormat &format);
0024 QOpenGLVersionProfile(const QOpenGLVersionProfile &other);
0025 ~QOpenGLVersionProfile();
0026
0027 QOpenGLVersionProfile &operator=(const QOpenGLVersionProfile &rhs);
0028
0029 QPair<int, int> version() const;
0030 void setVersion(int majorVersion, int minorVersion);
0031
0032 QSurfaceFormat::OpenGLContextProfile profile() const;
0033 void setProfile(QSurfaceFormat::OpenGLContextProfile profile);
0034
0035 bool hasProfiles() const;
0036 bool isLegacyVersion() const;
0037 bool isValid() const;
0038
0039 private:
0040 QOpenGLVersionProfilePrivate* d;
0041
0042 friend bool operator==(const QOpenGLVersionProfile &lhs, const QOpenGLVersionProfile &rhs) noexcept
0043 {
0044 if (lhs.profile() != rhs.profile())
0045 return false;
0046 return lhs.version() == rhs.version();
0047 }
0048
0049 friend bool operator!=(const QOpenGLVersionProfile &lhs, const QOpenGLVersionProfile &rhs) noexcept
0050 {
0051 return !operator==(lhs, rhs);
0052 }
0053 };
0054
0055 inline size_t qHash(const QOpenGLVersionProfile &v, size_t seed = 0) noexcept
0056 {
0057 return qHash(static_cast<int>(v.profile() * 1000)
0058 + v.version().first * 100 + v.version().second * 10, seed);
0059 }
0060
0061
0062 #ifndef QT_NO_DEBUG_STREAM
0063 Q_OPENGL_EXPORT QDebug operator<<(QDebug debug, const QOpenGLVersionProfile &vp);
0064 #endif
0065
0066 QT_END_NAMESPACE
0067
0068 #endif