Qt3DRender::QParameter Class
class Qt3DRender::QParameterPermite almacenar un par nombre-valor. Esto se corresponde con un uniforme de shader. Más información...
| Encabezado: | #include <Qt3DRender/QParameter> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS 3drender) target_link_libraries(mytarget PRIVATE Qt6::3drender) |
| qmake: | QT += 3drender |
| En QML: | Parameter |
| Heredado de: | Qt3DCore::QNode |
| Estado: | Obsoleto |
Esta clase está obsoleta. Se desaconseja encarecidamente su uso en código nuevo.
Propiedades
Funciones públicas
| QParameter(Qt3DCore::QNode *parent = nullptr) | |
| QParameter(const QString &name, Qt3DRender::QAbstractTexture *texture, Qt3DCore::QNode *parent = nullptr) | |
| QParameter(const QString &name, const QVariant &value, Qt3DCore::QNode *parent = nullptr) | |
| QString | name() const |
| QVariant | value() const |
Ranuras públicas
Señales
| void | nameChanged(const QString &name) |
| void | valueChanged(const QVariant &value) |
Descripción detallada
Se puede hacer referencia a un QParameter mediante un QRenderPass, QTechnique, QEffect, QMaterial, QTechniqueFilter o QRenderPassFilter. En tiempo de ejecución, dependiendo del shader seleccionado para un paso determinado del renderizado, el valor contenido en un QParameter se convertirá y se cargará si el shader contiene un uniforme cuyo nombre coincida con el del QParameter.
QParameter *param = new QParameter();
param->setName(QStringLiteral("diffuseColor"));
param->setValue(QColor::fromRgbF(0.0f, 0.0f, 1.0f, 1.0f));
// Alternatively you can create and set a QParameter this way
QParameter *param2 = new QParameter(QStringLiteral("diffuseColor"), QColor::fromRgbF(0.0f, 0.0f, 1.0f, 1.0f));
// Such QParameters will work with the following GLSL uniform shader declarations
// uniform vec4 diffuseColor;
// uniform vec3 diffuseColor;
// uniform vec2 diffuseColor;
// uniform float diffuseColor;Nota: hay que tener cuidado para garantizar que el valor envuelto por un QParameter pueda realmente convertirse a lo que espera el uniforme real. Proporcionar un valor almacenado como int cuando el uniforme real del sombreador es de tipo float podría dar lugar a comportamientos indefinidos.
Nota: cuando el uniforme de destino es una matriz, el nombre debe ser el del uniforme con [0] añadido al final.
Nota: El nodoQParameter no se puede desactivar.
QParameter *param = new QParameter();
QVariantList values = QVariantList() << 0.0f << 1.0f << 2.0f << 3.0f << 4.0f << 883.0f << 1340.0f << 1584.0f;
param->setName(QStringLiteral("diffuseValues[0]"));
param->setValue(values);
// Matching GLSL shader uniform declaration
// uniform float diffuseValues[8];En lo que respecta a la compatibilidad con texturas, el valor de QParameter debe establecerse en la subclase adecuada de « QAbstractTexture » que coincida con el tipo de muestreador del uniforme del sombreador.
QTexture2D *texture = new QTexture2D();
...
QParameter *param = new QParameter();
param->setName(QStringLiteral("diffuseTexture"));
param->setValue(QVariant::fromValue(texture));
// Works with the following GLSL uniform shader declaration
// uniform sampler2D diffuseTextureVéase también QAbstractTexture.
Documentación de propiedades
name : QString
Especifica el nombre del parámetro
Funciones de acceso:
| QString | name() const |
| void | setName(const QString &name) |
Señal del notificador:
| void | nameChanged(const QString &name) |
value : QVariant
Especifica el valor del parámetro
Funciones de acceso:
| QVariant | value() const |
| void | setValue(const QVariant &dv) |
Señal del notificador:
| void | valueChanged(const QVariant &value) |
Documentación de funciones de miembro
[explicit] QParameter::QParameter(Qt3DCore::QNode *parent = nullptr)
Crea un nuevo QParameter con el valor de « parent » especificado.
[explicit] QParameter::QParameter(const QString &name, Qt3DRender::QAbstractTexture *texture, Qt3DCore::QNode *parent = nullptr)
Crea un nuevo objeto `QParameter` con los valores especificados en ` parent ` y ` name `, y toma su valor de ` texture`.
[explicit] QParameter::QParameter(const QString &name, const QVariant &value, Qt3DCore::QNode *parent = nullptr)
Crea un nuevo QParameter con los valores especificados para « parent », « name » y « value ».
© 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.