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