- Qt 6.8
- Qt GUI
- C++ Classes
- QShaderKey
- Qt 6.8.2 Reference Documentation

# QShaderKey Class

Specifies the shading language, the version with flags, and the variant. More...

Header: | `#include <QShaderKey>`
CMake: | `find_package(Qt6 REQUIRED COMPONENTS Gui)` `target_link_libraries(mytarget PRIVATE Qt6::Gui)`
qmake: | `QT += gui`
Since: | Qt 6.6

- List of all members, including inherited members

## Public Functions

| 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

## Related Non-Members

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)

## Detailed Description

A default constructed QShaderKey has source set to SpirvShader and sourceVersion set to 100. sourceVariant defaults to StandardShader.

Note: This is a RHI API with limited compatibility guarantees, see QShader for details.

## Member Function Documentation

### `[constexpr noexcept]` QShaderKey::QShaderKey()

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

Constructs a new QShaderKey with shader type s, version sver, and variant svar.

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

Sets the shader type s.

See also source().

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

Sets the type of variant to use to svar.

See also sourceVariant().

### void QShaderKey::setSourceVersion(const QShaderVersion &sver)

Sets the shading language version sver.

See also sourceVersion().

### QShader::Source QShaderKey::source() const

Returns the shader type.

See also setSource().

### QShader::Variant QShaderKey::sourceVariant() const

Returns the type of the variant to use.

See also setSourceVariant().

### QShaderVersion QShaderKey::sourceVersion() const

Returns the shading language version.

See also setSourceVersion().

## Related Non-Members

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

Returns the hash value for key, using seed to seed the calculation.

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

Returns `false` if the values in the two QShaderKey objects lhs and rhs are equal; otherwise returns `true`.

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

Returns true if lhs is smaller than rhs.

Establishes a sorting order between the two keys lhs and rhs.

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

Returns `true` if the two QShaderKey objects lhs and rhs are equal.