![]() |
Qt 6.x
The Qt SDK
|
The QOpenGLPaintDevice class enables painting to an OpenGL context using QPainter. More...
#include <qopenglpaintdevice.h>
Public Member Functions | |
QOpenGLPaintDevice () | |
Constructs a QOpenGLPaintDevice. | |
QOpenGLPaintDevice (const QSize &size) | |
Constructs a QOpenGLPaintDevice with the given size. | |
QOpenGLPaintDevice (int width, int height) | |
Constructs a QOpenGLPaintDevice with the given width and height. | |
~QOpenGLPaintDevice () | |
Destroys the QOpenGLPaintDevice. | |
int | devType () const override |
QPaintEngine * | paintEngine () const override |
\reimp | |
QOpenGLContext * | context () const |
Returns the OpenGL context associated with the paint device. | |
QSize | size () const |
Returns the pixel size of the paint device. | |
void | setSize (const QSize &size) |
Sets the pixel size of the paint device to size. | |
void | setDevicePixelRatio (qreal devicePixelRatio) |
Sets the device pixel ratio for the paint device to devicePixelRatio. | |
qreal | dotsPerMeterX () const |
Returns the number of pixels per meter horizontally. | |
qreal | dotsPerMeterY () const |
Returns the number of pixels per meter vertically. | |
void | setDotsPerMeterX (qreal) |
Sets the number of pixels per meter horizontally to dpmx. | |
void | setDotsPerMeterY (qreal) |
Sets the number of pixels per meter vertically to dpmy. | |
void | setPaintFlipped (bool flipped) |
Sets whether painting should be flipped around the Y-axis or not to flipped. | |
bool | paintFlipped () const |
Returns true if painting is flipped around the Y-axis. | |
virtual void | ensureActiveTarget () |
This virtual method is provided as a callback to allow re-binding a target frame buffer object or context when different QOpenGLPaintDevice instances are issuing draw calls alternately. | |
![]() | |
virtual | ~QPaintDevice () |
virtual int | devType () const |
bool | paintingActive () const |
virtual QPaintEngine * | paintEngine () const =0 |
int | width () const |
int | height () const |
int | widthMM () const |
int | heightMM () const |
int | logicalDpiX () const |
int | logicalDpiY () const |
int | physicalDpiX () const |
int | physicalDpiY () const |
qreal | devicePixelRatio () const |
qreal | devicePixelRatioF () const |
int | colorCount () const |
int | depth () const |
Protected Member Functions | |
QOpenGLPaintDevice (QOpenGLPaintDevicePrivate &dd) | |
int | metric (QPaintDevice::PaintDeviceMetric metric) const override |
\reimp | |
![]() | |
QPaintDevice () noexcept | |
virtual int | metric (PaintDeviceMetric metric) const |
virtual void | initPainter (QPainter *painter) const |
virtual QPaintDevice * | redirected (QPoint *offset) const |
virtual QPainter * | sharedPainter () const |
Protected Attributes | |
QScopedPointer< QOpenGLPaintDevicePrivate > | d_ptr |
![]() | |
ushort | painters |
Additional Inherited Members | |
![]() | |
enum | PaintDeviceMetric { PdmWidth = 1 , PdmHeight , PdmWidthMM , PdmHeightMM , PdmNumColors , PdmDepth , PdmDpiX , PdmDpiY , PdmPhysicalDpiX , PdmPhysicalDpiY , PdmDevicePixelRatio , PdmDevicePixelRatioScaled } |
![]() | |
static qreal | devicePixelRatioFScale () |
The QOpenGLPaintDevice class enables painting to an OpenGL context using QPainter.
The QOpenGLPaintDevice uses the current QOpenGL context to render QPainter draw commands. The context is captured upon construction. It requires support for OpenGL (ES) 2.0 or higher.
Definition at line 19 of file qopenglpaintdevice.h.
QOpenGLPaintDevice::QOpenGLPaintDevice | ( | ) |
Constructs a QOpenGLPaintDevice.
The QOpenGLPaintDevice is only valid for the current context.
Definition at line 79 of file qopenglpaintdevice.cpp.
|
explicit |
Constructs a QOpenGLPaintDevice with the given size.
The QOpenGLPaintDevice is only valid for the current context.
Definition at line 91 of file qopenglpaintdevice.cpp.
QOpenGLPaintDevice::QOpenGLPaintDevice | ( | int | width, |
int | height | ||
) |
Constructs a QOpenGLPaintDevice with the given width and height.
The QOpenGLPaintDevice is only valid for the current context.
Definition at line 103 of file qopenglpaintdevice.cpp.
QOpenGLPaintDevice::~QOpenGLPaintDevice | ( | ) |
Destroys the QOpenGLPaintDevice.
Definition at line 120 of file qopenglpaintdevice.cpp.
References d_ptr, and QOpenGLPaintDevicePrivate::engine.
|
protected |
Definition at line 111 of file qopenglpaintdevice.cpp.
QOpenGLContext * QOpenGLPaintDevice::context | ( | ) | const |
Returns the OpenGL context associated with the paint device.
Definition at line 184 of file qopenglpaintdevice.cpp.
References QOpenGLPaintDevicePrivate::ctx, and d_ptr.
Referenced by QOpenGL2PaintEngineExPrivate::fill().
|
inlineoverridevirtual |
\reimp
Reimplemented from QPaintDevice.
Definition at line 28 of file qopenglpaintdevice.h.
References QInternal::OpenGL.
qreal QOpenGLPaintDevice::dotsPerMeterX | ( | ) | const |
Returns the number of pixels per meter horizontally.
Definition at line 263 of file qopenglpaintdevice.cpp.
References d_ptr, and QOpenGLPaintDevicePrivate::dpmx.
qreal QOpenGLPaintDevice::dotsPerMeterY | ( | ) | const |
Returns the number of pixels per meter vertically.
Definition at line 274 of file qopenglpaintdevice.cpp.
References d_ptr, and QOpenGLPaintDevicePrivate::dpmy.
|
virtual |
This virtual method is provided as a callback to allow re-binding a target frame buffer object or context when different QOpenGLPaintDevice instances are issuing draw calls alternately.
\l{QPainter::beginNativePainting()}{beginNativePainting()} will also trigger this method.
The default implementation does nothing.
Reimplemented in QOpenGLWindowPaintDevice, and QOpenGLWidgetPaintDevice.
Definition at line 332 of file qopenglpaintdevice.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QPaintDevice.
Definition at line 223 of file qopenglpaintdevice.cpp.
References d_ptr, QOpenGLPaintDevicePrivate::devicePixelRatio, QPaintDevice::devicePixelRatioFScale(), QOpenGLPaintDevicePrivate::dpmx, QOpenGLPaintDevicePrivate::dpmy, QSize::height(), metric(), QPaintDevice::PdmDepth, QPaintDevice::PdmDevicePixelRatio, QPaintDevice::PdmDevicePixelRatioScaled, QPaintDevice::PdmDpiX, QPaintDevice::PdmDpiY, QPaintDevice::PdmHeight, QPaintDevice::PdmHeightMM, QPaintDevice::PdmNumColors, QPaintDevice::PdmPhysicalDpiX, QPaintDevice::PdmPhysicalDpiY, QPaintDevice::PdmWidth, QPaintDevice::PdmWidthMM, qRound(), qWarning, QOpenGLPaintDevicePrivate::size, and QSize::width().
Referenced by metric().
|
overridevirtual |
\reimp
Implements QPaintDevice.
Definition at line 166 of file qopenglpaintdevice.cpp.
References engine.
bool QOpenGLPaintDevice::paintFlipped | ( | ) | const |
Returns true
if painting is flipped around the Y-axis.
Definition at line 317 of file qopenglpaintdevice.cpp.
References d_ptr, and QOpenGLPaintDevicePrivate::flipped.
Referenced by QOpenGL2PaintEngineExPrivate::setScissor(), QOpenGL2PaintEngineExPrivate::updateBrushUniforms(), and QOpenGL2PaintEngineExPrivate::updateMatrix().
Sets the device pixel ratio for the paint device to devicePixelRatio.
Definition at line 214 of file qopenglpaintdevice.cpp.
References d_ptr, QPaintDevice::devicePixelRatio(), and QOpenGLPaintDevicePrivate::devicePixelRatio.
Referenced by QOpenGLWindowPrivate::beginPaint(), QOpenGLWidgetPrivate::initialize(), and QOpenGLWidgetPrivate::recreateFbos().
Sets the number of pixels per meter horizontally to dpmx.
Definition at line 285 of file qopenglpaintdevice.cpp.
References d_ptr, and QOpenGLPaintDevicePrivate::dpmx.
Sets the number of pixels per meter vertically to dpmy.
Definition at line 296 of file qopenglpaintdevice.cpp.
References d_ptr, and QOpenGLPaintDevicePrivate::dpmy.
void QOpenGLPaintDevice::setPaintFlipped | ( | bool | flipped | ) |
Sets whether painting should be flipped around the Y-axis or not to flipped.
Definition at line 306 of file qopenglpaintdevice.cpp.
References d_ptr, and QOpenGLPaintDevicePrivate::flipped.
Sets the pixel size of the paint device to size.
Definition at line 206 of file qopenglpaintdevice.cpp.
References d_ptr, size(), and QOpenGLPaintDevicePrivate::size.
Referenced by QOpenGLWindowPrivate::beginPaint(), QOpenGLWidgetPrivate::initialize(), and QOpenGLWidgetPrivate::recreateFbos().
QSize QOpenGLPaintDevice::size | ( | ) | const |
Returns the pixel size of the paint device.
Definition at line 195 of file qopenglpaintdevice.cpp.
References d_ptr, and QOpenGLPaintDevicePrivate::size.
Referenced by setSize().
|
protected |
Definition at line 52 of file qopenglpaintdevice.h.
Referenced by ~QOpenGLPaintDevice(), context(), dotsPerMeterX(), dotsPerMeterY(), QOpenGLWidgetPaintDevice::ensureActiveTarget(), metric(), paintFlipped(), setDevicePixelRatio(), setDotsPerMeterX(), setDotsPerMeterY(), setPaintFlipped(), setSize(), and size().