本页内容

Qt3DExtras::QOrbitCameraController Class

class Qt3DExtras::QOrbitCameraController

QOrbitCameraController 类允许沿轨道路径控制场景摄像机。更多内容...

头文件: #include <qorbitcameracontroller.h>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3dextras)
target_link_libraries(mytarget PRIVATE Qt6::3dextras)
qmake: QT += 3dextras
继承自: Qt3DExtras::QAbstractCameraController
状态: 已弃用

该类已弃用。我们强烈建议不要在新代码中使用它。

属性

公共函数

bool inversePan() const
bool inverseTilt() const
bool inverseXTranslate() const
bool inverseYTranslate() const
QVector3D upVector() const
float zoomInLimit() const
bool zoomTranslateViewCenter() const

公共槽位

void setInversePan(bool isInverse)
void setInverseTilt(bool isInverse)
void setInverseXTranslate(bool isInverse)
void setInverseYTranslate(bool isInverse)
void setUpVector(const QVector3D &upVector)
void setZoomInLimit(float zoomInLimit)
void setZoomTranslateViewCenter(bool isTranslate)

信号

void inversePanChanged(bool isInverse)
void inverseTiltChanged(bool isInverse)
void inverseXTranslateChanged(bool isInverse)
void inverseYTranslateChanged(bool isInverse)
void upVectorChanged(const QVector3D &upVector)
void zoomInLimitChanged()
void zoomTranslateViewCenterChanged(bool isTranslate)

详细说明

控件包括:

输入操作
鼠标左键按住鼠标左键时,沿x轴移动鼠标可使摄像头左右移动,沿y轴移动则可使摄像头上下移动。
鼠标右键按住鼠标右键时,沿 x 轴移动鼠标会使摄像机围绕视图中心平移,沿 y 轴移动则会使摄像机围绕视图中心倾斜。
同时按下鼠标左键和右键同时按下鼠标左键和右键时,沿 y 轴移动鼠标可对镜头进行放大或缩小,同时保持视图中心不变。
鼠标滚轮在不改变视图中心的情况下,对镜头进行放大或缩小。
方向键相对于摄像机视口,垂直和水平移动摄像机。
Page Up 和 Page Down 键使摄像机向前或向后移动。
Shift 键将上下方向键的功能切换为在不改变视图中心的情况下对镜头进行缩放。其他移动键将被禁用。
Alt键将方向键的功能改为围绕视图中心平移和俯仰摄像机。禁用 Page Up 和 Page Down 键。
Esc键移动摄像机,使整个场景都显示在摄像机视口内。

属性文档

inversePan : bool

控制平移方向是否反转。

启用后,水平平移操作会使摄像机围绕视图中心朝相反方向旋转。

访问函数:

bool inversePan() const
void setInversePan(bool isInverse)

通知信号:

void inversePanChanged(bool isInverse)

inverseTilt : bool

控制倾斜方向是否反转。

启用后,垂直倾斜动作会使摄像机围绕视图中心朝相反方向旋转。

访问函数:

bool inverseTilt() const
void setInverseTilt(bool isInverse)

通知信号:

void inverseTiltChanged(bool isInverse)

inverseXTranslate : bool

控制水平平移是否反向。

启用后,鼠标的水平移动和输入将使摄像机向相反方向平移。

访问函数:

bool inverseXTranslate() const
void setInverseXTranslate(bool isInverse)

通知信号:

void inverseXTranslateChanged(bool isInverse)

inverseYTranslate : bool

控制垂直平移是否反向。

启用后,鼠标的垂直移动和输入将使摄像机朝相反方向平移。

访问函数:

bool inverseYTranslate() const
void setInverseYTranslate(bool isInverse)

通知信号:

void inverseYTranslateChanged(bool isInverse)

upVector : QVector3D

存储相机轨道旋转的向上向量。

“向上”向量定义了摄像机绕其旋转的垂直轴。默认值为 (0.0, 1.0, 0.0)。

访问函数:

QVector3D upVector() const
void setUpVector(const QVector3D &upVector)

通知信号:

void upVectorChanged(const QVector3D &upVector)

zoomInLimit : float

保存当前的放大限制。放大限制决定了摄像机可以放大到距离视图中心多近的位置。

访问函数:

float zoomInLimit() const
void setZoomInLimit(float zoomInLimit)

通知信号:

void zoomInLimitChanged()

zoomTranslateViewCenter : bool

控制在缩放操作期间视图中心是否发生平移。

启用时,缩放操作会平移视图中心;禁用时,缩放操作期间仅改变摄像机位置。默认值为 true。

访问函数:

bool zoomTranslateViewCenter() const
void setZoomTranslateViewCenter(bool isTranslate)

通知器信号:

void zoomTranslateViewCenterChanged(bool isTranslate)

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