In questa pagina

QRhiViewport Class

Specifica un rettangolo di visualizzazione. Altro...

Intestazione: #include <rhi/qrhi.h>
CMake: find_package(Qt6 REQUIRED COMPONENTS GuiPrivate)
target_link_libraries(mytarget PRIVATE Qt6::GuiPrivate)
qmake: QT += gui-private
A partire da: Qt 6.6

Funzioni pubbliche

QRhiViewport()
QRhiViewport(float x, float y, float w, float h, float minDepth = 0.0f, float maxDepth = 1.0f)
float maxDepth() const
float minDepth() const
void setMaxDepth(float maxDepth)
void setMinDepth(float minDepth)
void setViewport(float x, float y, float w, float h)
std::array<float, 4> viewport() const
size_t qHash(const QRhiViewport &key, size_t seed = 0)
bool operator!=(const QRhiViewport &a, const QRhiViewport &b)
bool operator==(const QRhiViewport &a, const QRhiViewport &b)

Descrizione dettagliata

Utilizzato con ` QRhiCommandBuffer::setViewport()`.

QRhi Si presuppone l'uso di coordinate del viewport in stile OpenGL, il che significa che x e y partono dall'angolo in basso a sinistra. Non sono ammessi valori negativi per larghezza o altezza.

L'utilizzo tipico è il seguente:

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);
// ...

Nota: si tratta di un'API RHI con garanzie di compatibilità limitate; per ulteriori dettagli, consultare QRhi.

Vedi anche QRhiCommandBuffer::setViewport(), QRhi::clipSpaceCorrMatrix() e QRhiScissor.

Documentazione delle funzioni membro

[constexpr noexcept default] QRhiViewport::QRhiViewport()

Crea una descrizione del viewport con un rettangolo vuoto e un intervallo di profondità compreso tra 0.0f e 1.0f.

Vedi anche QRhi::clipSpaceCorrMatrix().

QRhiViewport::QRhiViewport(float x, float y, float w, float h, float minDepth = 0.0f, float maxDepth = 1.0f)

Crea una descrizione del viewport con il rettangolo specificato da x, y, w, h e l'intervallo di profondità minDepth e maxDepth.

Nota: si presume chex e y corrispondano alla posizione in basso a sinistra. w e h non devono essere negativi; in caso contrario, la finestra di visualizzazione verrà ignorata da QRhiCommandBuffer::setViewport().

Vedi anche QRhi::clipSpaceCorrMatrix().

float QRhiViewport::maxDepth() const

Restituisce il valore maxDepth dell'intervallo di profondità del viewport.

Vedi anche setMaxDepth().

float QRhiViewport::minDepth() const

Restituisce il valore minDepth dell'intervallo di profondità del viewport.

Vedi anche setMinDepth().

void QRhiViewport::setMaxDepth(float maxDepth)

Imposta il valore di " maxDepth " dell'intervallo di profondità della finestra di visualizzazione. Per impostazione predefinita, questo valore è impostato su 1.0f.

Vedi anche maxDepth().

void QRhiViewport::setMinDepth(float minDepth)

Imposta l'minDepth e dell'intervallo di profondità della finestra di visualizzazione. Per impostazione predefinita, il valore è 0.0f.

Vedi anche minDepth().

void QRhiViewport::setViewport(float x, float y, float w, float h)

Imposta la posizione e le dimensioni del viewport su x, y, w e h.

Nota: i viewport sono specificati in un sistema di coordinate con origine nell'angolo in basso a sinistra.

Vedi anche viewport().

std::array<float, 4> QRhiViewport::viewport() const

Restituisce le coordinate x e y, la larghezza e l'altezza del viewport.

Vedi anche setViewport().

Elementi correlati non membri

[noexcept] size_t qHash(const QRhiViewport &key, size_t seed = 0)

Restituisce il valore hash di key, utilizzando seed come seme per il calcolo.

[noexcept] bool operator!=(const QRhiViewport &a, const QRhiViewport &b)

Restituisce ` false ` se i valori contenuti nei due oggetti ` QRhiViewport ` ( a e b ) sono uguali; in caso contrario, restituisce ` true`.

[noexcept] bool operator==(const QRhiViewport &a, const QRhiViewport &b)

Restituisce ` true ` se i valori contenuti nei due oggetti ` QRhiViewport ` a e b sono uguali.

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