- Qt 6.8
- Qt GUI
- C++ Classes
- QShaderCode
- Qt 6.8.3 Reference Documentation

# QShaderCode Class

Contains source or binary code for a shader and additional metadata. More...

Header: | `#include <QShaderCode>`
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

| QShaderCode()
| QShaderCode(const QByteArray &code, const QByteArray &entry = QByteArray())
QByteArray | entryPoint() const
void | setEntryPoint(const QByteArray &entry)
void | setShader(const QByteArray &code)
QByteArray | shader() const

## Related Non-Members

size_t | qHash(const QShaderCode &key, size_t seed = 0)
bool | operator!=(const QShaderCode &lhs, const QShaderCode &rhs)
bool | operator==(const QShaderCode &lhs, const QShaderCode &rhs)

## Detailed Description

When shader() is empty after retrieving a QShaderCode instance from QShader, it indicates no shader code was found for the requested key.

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

## Member Function Documentation

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

### QShaderCode::QShaderCode(const QByteArray &code, const QByteArray &entry = QByteArray())

Constructs a new QShaderCode with the specified shader source code and entry point name.

### QByteArray QShaderCode::entryPoint() const

Returns the entry point name.

See also setEntryPoint().

### void QShaderCode::setEntryPoint(const QByteArray &entry)

Sets the entry point name.

See also entryPoint().

### void QShaderCode::setShader(const QByteArray &code)

Sets the shader source or byte code.

See also shader().

### QByteArray QShaderCode::shader() const

Returns the shader source or bytecode.

See also setShader().

## Related Non-Members

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

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

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

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

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

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