- Qt 6.8
- Qt 3D
- C++ Classes
- Qt3DRender
- QViewport
- Qt 6.8.0 Reference Documentation

# QViewport Class

class Qt3DRender::QViewport

A viewport on the Qt3D Scene. More...

Header: | #include <QViewport>
CMake: | find_package(Qt6 REQUIRED COMPONENTS 3drender) target_link_libraries(mytarget PRIVATE Qt6::3drender)
qmake: | QT += 3drender
Instantiated By: | Viewport
Inherits: | Qt3DRender::QFrameGraphNode

- List of all members, including inherited members

## Properties

- gamma : float
- normalizedRect : QRectF

## Public Functions

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

## Public Slots

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

## Signals

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

## Detailed Description

Qt3DRender::QViewport of the scene specifies at which portion of the render surface Qt3D is rendering to. Area outside the viewport is left untouched. It also controls global parameters to the rendering in that viewport like gamma.

## Property Documentation

### gamma : float

Specifies the gamma factor for the viewport. The default is 2.2 which should give proper result on most screens.

Access functions:

float | gamma() const
void | setGamma(float gamma)

Notifier signal:

void | gammaChanged(float gamma)

### normalizedRect : QRectF

Specifies the normalised rectangle for the viewport, i.e. the viewport rectangle is specified relative to the render surface size. Whole surface sized viewport is specified as [0.0, 0.0, 1.0, 1.0], which is the default.

Access functions:

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

Notifier signal:

void | normalizedRectChanged(const QRectF &normalizedRect)

## Member Function Documentation

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

Constructs QViewport with given parent.