Qt3DRender::QViewport Class

class Qt3DRender::QViewport

Qt3D 场景中的视口。更多

页眉: #include <QViewport>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3drender)
target_link_libraries(mytarget PRIVATE Qt6::3drender)
qmake: QT += 3drender
在 QML 中: Viewport
继承: Qt3DRender::QFrameGraphNode
状态:已废弃

属性

公共功能

QViewport(Qt3DCore::QNode *parent = nullptr)
float gamma() const
QRectF normalizedRect() const

公共插槽

void setGamma(float gamma)
void setNormalizedRect(const QRectF &normalizedRect)

信号

void gammaChanged(float gamma)
void normalizedRectChanged(const QRectF &normalizedRect)

详细说明

Qt3DRender::QViewport 指定 Qt3D 渲染场景表面的哪个部分。视口以外的区域不会被渲染。它还控制该视口中渲染的全局参数(如伽玛值)。

属性文档

gamma : float

指定视口的伽玛系数。默认值为 2.2,在大多数屏幕上都能获得合适的效果。

访问功能:

float gamma() const
void setGamma(float gamma)

通知信号

void gammaChanged(float gamma)

normalizedRect : QRectF

指定视口的归一化矩形,即相对于渲染表面大小的视口矩形。整个曲面大小的视口默认设置为[0.0, 0.0, 1.0, 1.0]。

访问功能

QRectF normalizedRect() const
void setNormalizedRect(const QRectF &normalizedRect)

Notifier 信号:

void normalizedRectChanged(const QRectF &normalizedRect)

成员函数 文档

[explicit] QViewport::QViewport(Qt3DCore::QNode *parent = nullptr)

使用给定的parent 构建 QViewport。

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