Auf dieser Seite

QOpenGLVersionProfile Class

Die Klasse „QOpenGLVersionProfile“ repräsentiert die Version und gegebenenfalls das Profil eines OpenGL-Kontexts. Mehr...

Header: #include <QOpenGLVersionProfile>
CMake: find_package(Qt6 REQUIRED COMPONENTS OpenGL)
target_link_libraries(mytarget PRIVATE Qt6::OpenGL)
qmake: QT += opengl

Öffentliche Funktionen

QOpenGLVersionProfile()
QOpenGLVersionProfile(const QSurfaceFormat &format)
QOpenGLVersionProfile(const QOpenGLVersionProfile &other)
~QOpenGLVersionProfile()
bool hasProfiles() const
bool isLegacyVersion() const
bool isValid() const
QSurfaceFormat::OpenGLContextProfile profile() const
void setProfile(QSurfaceFormat::OpenGLContextProfile profile)
void setVersion(int majorVersion, int minorVersion)
std::pair<int, int> version() const
QOpenGLVersionProfile &operator=(const QOpenGLVersionProfile &rhs)

Ausführliche Beschreibung

Ein Objekt dieser Klasse kann an QOpenGLContext::versionFunctions() übergeben werden, um ein Funktionsobjekt für eine bestimmte Version und ein bestimmtes Profil von OpenGL anzufordern.

Außerdem enthält es einige Hilfsfunktionen, um zu prüfen, ob eine Version Profile unterstützt oder es sich um eine ältere Version handelt.

Dokumentation zu den Mitgliedsfunktionen

QOpenGLVersionProfile::QOpenGLVersionProfile()

Erstellt ein standardmäßiges, ungültiges QOpenGLVersionProfile-Objekt.

[explicit] QOpenGLVersionProfile::QOpenGLVersionProfile(const QSurfaceFormat &format)

Erstellt ein QOpenGLVersionProfile-Objekt, das mit der Version und dem Profil von format initialisiert wird.

QOpenGLVersionProfile::QOpenGLVersionProfile(const QOpenGLVersionProfile &other)

Erstellt eine Kopie von „ other “.

[noexcept] QOpenGLVersionProfile::~QOpenGLVersionProfile()

Löscht das „ QOpenGLVersionProfile “-Objekt.

bool QOpenGLVersionProfile::hasProfiles() const

Gibt „ true “ zurück, wenn Profile von der OpenGL-Version unterstützt werden, die von „ version()“ zurückgegeben wird. Nur OpenGL-Versionen >= 3.2 unterstützen Profile.

Siehe auch profile() und version().

bool QOpenGLVersionProfile::isLegacyVersion() const

Gibt zurück true: Dies ist die von version() zurückgegebene OpenGL-Version. Diese Funktion enthält veraltete Funktionen und unterstützt keine Profile, d. h., wenn die OpenGL-Version <= 3.1 ist.

bool QOpenGLVersionProfile::isValid() const

Gibt „ true “ zurück, wenn die Versionsnummer gültig ist. Beachten Sie, dass diese Funktion bei einem standardmäßig erstellten „ QOpenGLVersionProfile “-Objekt „ false “ zurückgibt.

Siehe auch setVersion() und version().

QSurfaceFormat::OpenGLContextProfile QOpenGLVersionProfile::profile() const

Gibt das OpenGL-Profil zurück. Ist nur dann sinnvoll, wenn Profile von dieser Version unterstützt werden.

Siehe auch setProfile().

void QOpenGLVersionProfile::setProfile(QSurfaceFormat::OpenGLContextProfile profile)

Legt das OpenGL-Profil „ profile “ fest. Dies ist nur sinnvoll, wenn Profile von dieser Version unterstützt werden.

Siehe auch profile().

void QOpenGLVersionProfile::setVersion(int majorVersion, int minorVersion)

Setzt die Haupt- und Nebenversionsnummern auf majorVersion bzw. minorVersion.

Siehe auch version().

std::pair<int, int> QOpenGLVersionProfile::version() const

Gibt ein std::pair<int,int> zurück, dessen Komponenten jeweils die Haupt- und Nebenversionsnummern von OpenGL darstellen.

Siehe auch ` setVersion()`.

QOpenGLVersionProfile &QOpenGLVersionProfile::operator=(const QOpenGLVersionProfile &rhs)

Weist diesem „ QOpenGLVersionProfile “-Objekt die Version und das Profil von „ rhs “ zu.

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.