PySide6.QtGui.QRhiViewport

class QRhiViewport

Specifies a viewport rectangle.

Details

Used with setViewport() .

QRhi assumes OpenGL-style viewport coordinates, meaning x and y are bottom-left. Negative width or height are not allowed.

Typical usage is like the following:

const QSize outputSizeInPixels = swapchain->currentPixelSize();
const QRhiViewport viewport(0, 0, outputSizeInPixels.width(), outputSizeInPixels.height());
cb->beginPass(swapchain->currentFrameRenderTarget(), Qt::black, { 1.0f, 0 });
cb->setGraphicsPipeline(ps);
cb->setViewport(viewport);
// ...

Note

This is a RHI API with limited compatibility guarantees, see QRhi for details.

Added in version 6.6.

Synopsis

Methods

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

__init__()

Constructs a viewport description with an empty rectangle and a depth range of 0.0f - 1.0f.

__init__(x, y, w, h[, minDepth=0.0f[, maxDepth=1.0f]])
Parameters:
  • x – float

  • y – float

  • w – float

  • h – float

  • minDepth – float

  • maxDepth – float

Constructs a viewport description with the rectangle specified by x, y, w, h and the depth range minDepth and maxDepth.

Note

x and y are assumed to be the bottom-left position. w and h should not be negative, the viewport will be ignored by setViewport() otherwise.

maxDepth()
Return type:

float

Returns the maxDepth value of the depth range of the viewport.

See also

setMaxDepth()

minDepth()
Return type:

float

Returns the minDepth value of the depth range of the viewport.

See also

setMinDepth()

__ne__(b)
Parameters:

bQRhiViewport

Return type:

bool

__eq__(b)
Parameters:

bQRhiViewport

Return type:

bool

setMaxDepth(maxDepth)
Parameters:

maxDepth – float

Sets the maxDepth of the depth range of the viewport. By default this is set to 1.0f.

See also

maxDepth()

setMinDepth(minDepth)
Parameters:

minDepth – float

Sets the minDepth of the depth range of the viewport. By default this is set to 0.0f.

See also

minDepth()

setViewport(x, y, w, h)
Parameters:
  • x – float

  • y – float

  • w – float

  • h – float

Sets the viewport’s position and size to x, y, w, and h.

Note

Viewports are specified in a coordinate system that has its origin in the bottom-left.

See also

viewport()

viewport()
Return type:

.std.arrayfloat,4

Returns the viewport x, y, width, and height.

See also

setViewport()