本页内容

QShaderKey Class

指定着色语言、带标志的版本以及变体。更多...

头文件: #include <qshader.h>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
自: Qt 6.6

公共函数

QShaderKey()
QShaderKey(QShader::Source s, const QShaderVersion &sver, QShader::Variant svar = QShader::StandardShader)
void setSource(QShader::Source s)
void setSourceVariant(QShader::Variant svar)
void setSourceVersion(const QShaderVersion &sver)
QShader::Source source() const
QShader::Variant sourceVariant() const
QShaderVersion sourceVersion() const
size_t qHash(const QShaderKey &key, size_t seed = 0)
bool operator!=(const QShaderKey &lhs, const QShaderKey &rhs)
bool operator<(const QShaderKey &lhs, const QShaderKey &rhs)
bool operator==(const QShaderKey &lhs, const QShaderKey &rhs)

详细说明

默认构造的 QShaderKey 的 source 属性设置为 SpirvShader,sourceVersion 属性设置为 100。sourceVariant 的默认值为 StandardShader。

注意:这是一个 兼容性保证有限的 RHI API,详情请参阅QShader 。

成员函数文档

[constexpr noexcept default] QShaderKey::QShaderKey()

QShaderKey::QShaderKey(QShader::Source s, const QShaderVersion &sver, QShader::Variant svar = QShader::StandardShader)

创建一个新的 QShaderKey,其着色器类型为s ,版本为sver ,变体为svar 。

void QShaderKey::setSource(QShader::Source s)

设置着色器类型为s 。

另请参阅 source()。

void QShaderKey::setSourceVariant(QShader::Variant svar)

将要使用的变体类型设置为svar 。

另请参阅 sourceVariant()。

void QShaderKey::setSourceVersion(const QShaderVersion &sver)

设置着色语言版本sver 。

另请参阅 sourceVersion()。

QShader::Source QShaderKey::source() const

返回着色器类型。

另请参阅 setSource()。

QShader::Variant QShaderKey::sourceVariant() const

返回要使用的变体类型。

另请参阅 setSourceVariant()。

QShaderVersion QShaderKey::sourceVersion() const

返回着色语言的版本。

另请参阅 setSourceVersion()。

相关的非成员

[noexcept] size_t qHash(const QShaderKey &key, size_t seed = 0)

返回key 的哈希值,并使用seed 作为计算的种子。

[noexcept] bool operator!=(const QShaderKey &lhs, const QShaderKey &rhs)

如果两个QShaderKey 对象lhs 和rhs 中的值相等,则返回false ;否则返回true 。

[noexcept] bool operator<(const QShaderKey &lhs, const QShaderKey &rhs)

如果lhs 小于rhs ,则返回 true。

在两个键lhs 和rhs 之间建立排序顺序。

[noexcept] bool operator==(const QShaderKey &lhs, const QShaderKey &rhs)

如果两个QShaderKey 对象lhs 和rhs 相等,则返回true 。

© 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.