Q3DCamera Class
Representación de una cámara en el espacio 3D. Más...
| Cabecera: | #include <Q3DCamera> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS DataVisualization)target_link_libraries(mytarget PRIVATE Qt6::DataVisualization) |
| qmake: | QT += datavisualization |
| Desde: | QtDataVisualization 1.0 |
| En QML: | Camera3D |
| Hereda: | Q3DObject |
Tipos Públicos
| enum | CameraPreset { CameraPresetNone, CameraPresetFrontLow, CameraPresetFront, CameraPresetFrontHigh, CameraPresetLeftLow, …, CameraPresetDirectlyBelow } |
Propiedades
|
|
Funciones públicas
| Q3DCamera(QObject *parent = nullptr) | |
| virtual | ~Q3DCamera() |
| Q3DCamera::CameraPreset | cameraPreset() const |
| float | maxZoomLevel() const |
| float | minZoomLevel() const |
| void | setCameraPosition(float horizontal, float vertical, float zoom = 100.0f) |
| void | setCameraPreset(Q3DCamera::CameraPreset preset) |
| void | setMaxZoomLevel(float zoomLevel) |
| void | setMinZoomLevel(float zoomLevel) |
| void | setTarget(const QVector3D &target) |
| void | setWrapXRotation(bool isEnabled) |
| void | setWrapYRotation(bool isEnabled) |
| void | setXRotation(float rotation) |
| void | setYRotation(float rotation) |
| void | setZoomLevel(float zoomLevel) |
| QVector3D | target() const |
| bool | wrapXRotation() const |
| bool | wrapYRotation() const |
| float | xRotation() const |
| float | yRotation() const |
| float | zoomLevel() const |
Funciones públicas reimplementadas
| virtual void | copyValuesFrom(const Q3DObject &source) override |
Señales
| void | cameraPresetChanged(Q3DCamera::CameraPreset preset) |
| void | maxZoomLevelChanged(float zoomLevel) |
| void | minZoomLevelChanged(float zoomLevel) |
| void | targetChanged(const QVector3D &target) |
| void | wrapXRotationChanged(bool isEnabled) |
| void | wrapYRotationChanged(bool isEnabled) |
| void | xRotationChanged(float rotation) |
| void | yRotationChanged(float rotation) |
| void | zoomLevelChanged(float zoomLevel) |
Descripción Detallada
Q3DCamera representa una cámara 3D básica de órbita alrededor del punto central que se utiliza al renderizar la visualización de datos. La clase ofrece métodos simples para rotar la cámara alrededor del origen y establecer el nivel de zoom.
Documentación de tipos de miembros
enum Q3DCamera::CameraPreset
Posiciones predefinidas para la cámara.
| Constante | Valor | Descripción |
|---|---|---|
Q3DCamera::CameraPresetNone | -1 | Se utiliza para indicar que no se ha establecido un preset, o que la escena se ha rotado libremente. |
Q3DCamera::CameraPresetFrontLow | 0 | |
Q3DCamera::CameraPresetFront | 1 | |
Q3DCamera::CameraPresetFrontHigh | 2 | |
Q3DCamera::CameraPresetLeftLow | 3 | |
Q3DCamera::CameraPresetLeft | 4 | |
Q3DCamera::CameraPresetLeftHigh | 5 | |
Q3DCamera::CameraPresetRightLow | 6 | |
Q3DCamera::CameraPresetRight | 7 | |
Q3DCamera::CameraPresetRightHigh | 8 | |
Q3DCamera::CameraPresetBehindLow | 9 | |
Q3DCamera::CameraPresetBehind | 10 | |
Q3DCamera::CameraPresetBehindHigh | 11 | |
Q3DCamera::CameraPresetIsometricLeft | 12 | |
Q3DCamera::CameraPresetIsometricLeftHigh | 13 | |
Q3DCamera::CameraPresetIsometricRight | 14 | |
Q3DCamera::CameraPresetIsometricRightHigh | 15 | |
Q3DCamera::CameraPresetDirectlyAbove | 16 | |
Q3DCamera::CameraPresetDirectlyAboveCW45 | 17 | |
Q3DCamera::CameraPresetDirectlyAboveCCW45 | 18 | |
Q3DCamera::CameraPresetFrontBelow | 19 | En Q3DBars a partir de CameraPresetFrontBelow sólo funcionan para gráficos que incluyan valores negativos. Actúan como Preset...Bajo para valores sólo positivos. |
Q3DCamera::CameraPresetLeftBelow | 20 | |
Q3DCamera::CameraPresetRightBelow | 21 | |
Q3DCamera::CameraPresetBehindBelow | 22 | |
Q3DCamera::CameraPresetDirectlyBelow | 23 | Actúa como CameraPresetFrontLow para barras sólo positivas. |
Documentación de Propiedades
cameraPreset : CameraPreset
Esta propiedad contiene el preajuste de cámara actualmente activo.
Si no se establece ningún valor en CameraPreset, se utilizará CameraPresetNone por defecto.
Funciones de acceso:
| Q3DCamera::CameraPreset | cameraPreset() const |
| void | setCameraPreset(Q3DCamera::CameraPreset preset) |
Señal del notificador:
| void | cameraPresetChanged(Q3DCamera::CameraPreset preset) |
maxZoomLevel : float
Esta propiedad contiene el nivel máximo permitido de zoom de la cámara.
Si el nivel máximo se establece en un nuevo valor inferior al nivel mínimo existente, el nivel mínimo también se ajusta al nuevo máximo. Si el zoomLevel actual está fuera de los nuevos límites, también se ajusta. Por defecto es 500.0f.
Funciones de acceso:
| float | maxZoomLevel() const |
| void | setMaxZoomLevel(float zoomLevel) |
Señal de aviso:
| void | maxZoomLevelChanged(float zoomLevel) |
Véase también zoomLevel y minZoomLevel.
minZoomLevel : float
Esta propiedad contiene el nivel mínimo permitido de zoom de la cámara.
Si el nivel mínimo se establece en un nuevo valor superior al nivel máximo existente, el nivel máximo también se ajusta al nuevo mínimo. Si el zoomLevel actual está fuera de los nuevos límites, también se ajusta. El minZoomLevel no puede establecerse por debajo de 1.0f. Por defecto es 10.0f.
Funciones de acceso:
| float | minZoomLevel() const |
| void | setMinZoomLevel(float zoomLevel) |
Señal notificadora:
| void | minZoomLevelChanged(float zoomLevel) |
Véase también zoomLevel y maxZoomLevel.
[since QtDataVisualization 1.2] target : QVector3D
Esta propiedad contiene el objetivo de la cámara como un vector o vértice en el espacio 3D.
Por defecto es QVector3D(0.0, 0.0, 0.0).
Los valores de coordenadas válidos están entre -1.0...1.0, donde los valores de borde indican los bordes del rango de ejes correspondiente. Cualquier valor fuera de este rango se fija al borde.
Nota: Para los gráficos de barras, la coordenada Y se ignora y la cámara siempre apunta a un punto en el fondo horizontal.
Esta propiedad se introdujo en QtDataVisualization 1.2.
Funciones de acceso:
| QVector3D | target() const |
| void | setTarget(const QVector3D &target) |
Señal notificadora:
| void | targetChanged(const QVector3D &target) |
wrapXRotation : bool
Esta propiedad mantiene el comportamiento de los límites mínimo y máximo en la rotación X.
Si se establece en true, la rotación X de la cámara se envuelve del mínimo al máximo y del máximo al mínimo. Si se establece en false, la rotación X de la cámara se limita al sector determinado por los valores mínimo y máximo. Por defecto está ajustado a true.
Funciones de acceso:
| bool | wrapXRotation() const |
| void | setWrapXRotation(bool isEnabled) |
Señal de notificación:
| void | wrapXRotationChanged(bool isEnabled) |
wrapYRotation : bool
Esta propiedad mantiene el comportamiento de los límites mínimo y máximo en la rotación Y.
Si true, la rotación Y de la cámara se envuelve de mínimo a máximo y de máximo a mínimo. Si false, la rotación Y de la cámara se limita al sector determinado por los valores mínimo y máximo. Por defecto es true.
Funciones de acceso:
| bool | wrapYRotation() const |
| void | setWrapYRotation(bool isEnabled) |
Señal de notificación:
| void | wrapYRotationChanged(bool isEnabled) |
xRotation : float
Esta propiedad contiene el ángulo de rotación X de la cámara alrededor del punto objetivo en grados.
Funciones de acceso:
| float | xRotation() const |
| void | setXRotation(float rotation) |
Señal del notificador:
| void | xRotationChanged(float rotation) |
yRotation : float
Esta propiedad contiene el ángulo de rotación Y de la cámara alrededor del punto objetivo en grados.
Funciones de acceso:
| float | yRotation() const |
| void | setYRotation(float rotation) |
Señal del notificador:
| void | yRotationChanged(float rotation) |
zoomLevel : float
Esta propiedad contiene el nivel de zoom de la cámara en porcentaje.
El valor por defecto de 100.0f significa que no hay zoom establecido en la cámara. El valor está limitado por las propiedades minZoomLevel y maxZoomLevel.
Funciones de acceso:
| float | zoomLevel() const |
| void | setZoomLevel(float zoomLevel) |
Señal del notificador:
| void | zoomLevelChanged(float zoomLevel) |
Véase también minZoomLevel y maxZoomLevel.
Documentación de las funciones miembro
[explicit] Q3DCamera::Q3DCamera(QObject *parent = nullptr)
Construye una nueva cámara 3D con la posición fijada en el origen, la dirección hacia arriba orientada hacia el eje Y y mirando al origen por defecto. Se puede dar un parámetro opcional parent que se pasa al constructor QObject.
[virtual noexcept] Q3DCamera::~Q3DCamera()
Destruye el objeto cámara.
[override virtual] void Q3DCamera::copyValuesFrom(const Q3DObject &source)
Reimplementa: Q3DObject::copyValuesFrom(const Q3DObject &source).
Copia las propiedades de la cámara 3D de la cámara fuente dada. Los valores se copian de source a este objeto.
void Q3DCamera::setCameraPosition(float horizontal, float vertical, float zoom = 100.0f)
Función de utilidad que establece las rotaciones de la cámara y la distancia.horizontal y vertical definen las rotaciones de la cámara que se utilizarán. Se puede dar el parámetro opcional zoom para establecer el porcentaje de zoom de la cámara dentro de los límites definidos por las propiedades minZoomLevel y maxZoomLevel.
© 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.