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
qopenglversionprofile.h
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
4#ifndef QOPENGLVERSIONPROFILE_H
5#define QOPENGLVERSIONPROFILE_H
6
7#include <QtOpenGL/qtopenglglobal.h>
8
9#include <QtGui/QSurfaceFormat>
10
11#include <QtCore/qhashfunctions.h>
12
13QT_BEGIN_NAMESPACE
14
15class QOpenGLVersionProfilePrivate;
16class QDebug;
17
18class Q_OPENGL_EXPORT QOpenGLVersionProfile
19{
20public:
21 QOpenGLVersionProfile();
22 explicit QOpenGLVersionProfile(const QSurfaceFormat &format);
23 QOpenGLVersionProfile(const QOpenGLVersionProfile &other);
24 ~QOpenGLVersionProfile();
25
26 QOpenGLVersionProfile &operator=(const QOpenGLVersionProfile &rhs);
27
28 std::pair<int, int> version() const;
29 void setVersion(int majorVersion, int minorVersion);
30
31 QSurfaceFormat::OpenGLContextProfile profile() const;
32 void setProfile(QSurfaceFormat::OpenGLContextProfile profile);
33
34 bool hasProfiles() const;
35 bool isLegacyVersion() const;
36 bool isValid() const;
37
38private:
39 QOpenGLVersionProfilePrivate* d;
40
41 friend bool operator==(const QOpenGLVersionProfile &lhs, const QOpenGLVersionProfile &rhs) noexcept
42 {
43 if (lhs.profile() != rhs.profile())
44 return false;
45 return lhs.version() == rhs.version();
46 }
47
48 friend bool operator!=(const QOpenGLVersionProfile &lhs, const QOpenGLVersionProfile &rhs) noexcept
49 {
50 return !operator==(lhs, rhs);
51 }
52};
53
54inline size_t qHash(const QOpenGLVersionProfile &v, size_t seed = 0) noexcept
55{
56 return qHash(static_cast<int>(v.profile() * 1000)
57 + v.version().first * 100 + v.version().second * 10, seed);
58}
59
60
61#ifndef QT_NO_DEBUG_STREAM
62Q_OPENGL_EXPORT QDebug operator<<(QDebug debug, const QOpenGLVersionProfile &vp);
63#endif // !QT_NO_DEBUG_STREAM
64
65QT_END_NAMESPACE
66
67#endif // QOPENGLVERSIONPROFILE_H
QSurfaceFormat::OpenGLContextProfile profile
Combined button and popup list for selecting options.
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
Definition qdir.cpp:2462
constexpr size_t qHash(const QSize &s, size_t seed=0) noexcept
Definition qsize.h:191