本页内容

Qt3DRender::QViewport Class

class Qt3DRender::QViewport

Qt3D 场景中的视口。更多内容...

标题: #include <qviewport.h>
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)

通知信号:

void normalizedRectChanged(const QRectF &normalizedRect)

成员函数文档

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

根据给定的parent 实例化QViewport。

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