- Qt 6.9
- Qt GUI
- C++ Classes
- QtGuiPrivate
- QRhiScissor
- Qt 6.9.3 Reference Documentation

# QRhiScissor Class

Specifies a scissor rectangle. More...

Header: | `#include <rhi/qrhi.h>`
CMake: | `find_package(Qt6 REQUIRED COMPONENTS Gui)` `target_link_libraries(mytarget PRIVATE Qt6::GuiPrivate)`
qmake: | `QT += gui-private`
Since: | Qt 6.6

- List of all members, including inherited members

## Public Functions

| QRhiScissor()
| QRhiScissor(int x, int y, int w, int h)
std::array<int, 4> | scissor() const
void | setScissor(int x, int y, int w, int h)

## Related Non-Members

size_t | qHash(const QRhiScissor &key, size_t seed = 0)
bool | operator!=(const QRhiScissor &a, const QRhiScissor &b)
bool | operator==(const QRhiScissor &a, const QRhiScissor &b)

## Detailed Description

Used with QRhiCommandBuffer::setScissor(). Setting a scissor rectangle is only possible with a QRhiGraphicsPipeline that has QRhiGraphicsPipeline::UsesScissor set.

QRhi assumes OpenGL-style scissor coordinates, meaning x and y are bottom-left. Negative width or height are not allowed. However, apart from that, the flexible OpenGL semantics apply: negative x and y, partially out of bounds rectangles, etc. will be handled gracefully, clamping as appropriate. Therefore, any rendering logic targeting OpenGL can feed scissor rectangles into QRhiScissor as-is, without any adaptation.

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

See also QRhiCommandBuffer::setScissor() and QRhiViewport.

## Member Function Documentation

### `[constexpr noexcept]` QRhiScissor::QRhiScissor()

Constructs an empty scissor.

### QRhiScissor::QRhiScissor(int x, int y, int w, int h)

Constructs a scissor with the rectangle specified by x, y, w, and h.

Note: x and y are assumed to be the bottom-left position. Negative w or h are not allowed, such scissor rectangles will be ignored by QRhiCommandBuffer. Other than that, the flexible OpenGL semantics apply: negative x and y, partially out of bounds rectangles, etc. will be handled gracefully, clamping as appropriate.

### std::array<int, 4> QRhiScissor::scissor() const

Returns the scissor position and size.

See also setScissor().

### void QRhiScissor::setScissor(int x, int y, int w, int h)

Sets the scissor position and size to x, y, w, h.

Note: The position is always expected to be specified in a coordinate system that has its origin in the bottom-left corner, like OpenGL.

See also scissor().

## Related Non-Members

### `[noexcept]` size_t qHash(const QRhiScissor &key, size_t seed = 0)

Returns the hash value for key, using seed to seed the calculation.

### `[noexcept]` bool operator!=(const QRhiScissor &a, const QRhiScissor &b)

Returns `false` if the values in the two QRhiScissor objects a and b are equal; otherwise returns `true`.

### `[noexcept]` bool operator==(const QRhiScissor &a, const QRhiScissor &b)

Returns `true` if the values in the two QRhiScissor objects a and b are equal.