Qt 4.8
Public Functions | Properties | Friends | List of all members
QGLWidgetGLPaintDevice Class Reference

#include <qglpaintdevice_p.h>

Inheritance diagram for QGLWidgetGLPaintDevice:
QGLPaintDevice QPaintDevice

Public Functions

virtual void beginPaint ()
 
virtual QGLContextcontext () const
 
virtual void endPaint ()
 
virtual QPaintEnginepaintEngine () const
 
 QGLWidgetGLPaintDevice ()
 
void setWidget (QGLWidget *)
 
virtual QSize size () const
 
- Public Functions inherited from QGLPaintDevice
virtual bool alphaRequested () const
 
int devType () const
 
virtual void ensureActiveTarget ()
 
virtual QGLFormat format () const
 
virtual bool isFlipped () const
 
 QGLPaintDevice ()
 
virtual ~QGLPaintDevice ()
 
- Public Functions inherited from QPaintDevice
int colorCount () const
 
int depth () const
 
virtual HDC getDC () const
 
int height () const
 
int heightMM () const
 
int logicalDpiX () const
 
int logicalDpiY () const
 
QT_DEPRECATED int numColors () const
 
bool paintingActive () const
 
int physicalDpiX () const
 
int physicalDpiY () const
 
virtual void releaseDC (HDC hdc) const
 
int width () const
 
int widthMM () const
 
virtual ~QPaintDevice ()
 

Properties

QGLWidgetglWidget
 

Friends

class QGLWidget
 

Additional Inherited Members

- Public Types inherited from QPaintDevice
enum  PaintDeviceMetric {
  PdmWidth = 1, PdmHeight, PdmWidthMM, PdmHeightMM,
  PdmNumColors, PdmDepth, PdmDpiX, PdmDpiY,
  PdmPhysicalDpiX, PdmPhysicalDpiY
}
 
- Static Public Functions inherited from QGLPaintDevice
static QGLPaintDevicegetDevice (QPaintDevice *)
 
- Static Public Functions inherited from QPaintDevice
static QWSDisplayqwsDisplay ()
 
- Protected Functions inherited from QGLPaintDevice
int metric (QPaintDevice::PaintDeviceMetric metric) const
 
- Protected Functions inherited from QPaintDevice
 QPaintDevice ()
 
- Protected Variables inherited from QGLPaintDevice
GLuint m_previousFBO
 
GLuint m_thisFBO
 
- Protected Variables inherited from QPaintDevice
ushort painters
 

Detailed Description

Definition at line 93 of file qglpaintdevice_p.h.

Constructors and Destructors

◆ QGLWidgetGLPaintDevice()

QGLWidgetGLPaintDevice::QGLWidgetGLPaintDevice ( )

Definition at line 155 of file qglpaintdevice.cpp.

156 {
157 }

Functions

◆ beginPaint()

void QGLWidgetGLPaintDevice::beginPaint ( )
virtual

Reimplemented from QGLPaintDevice.

Definition at line 169 of file qglpaintdevice.cpp.

170 {
172  if (!glWidget->d_func()->disable_clear_on_painter_begin && glWidget->autoFillBackground()) {
174  glClearColor(0.0, 0.0, 0.0, 0.0);
175  else {
176  const QColor &c = glWidget->palette().brush(glWidget->backgroundRole()).color();
177  float alpha = c.alphaF();
178  glClearColor(c.redF() * alpha, c.greenF() * alpha, c.blueF() * alpha, alpha);
179  }
180  if (context()->d_func()->workaround_needsFullClearOnEveryFrame)
182  else
183  glClear(GL_COLOR_BUFFER_BIT);
184  }
185 }
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
qreal alphaF() const
Returns the alpha color component of this color.
Definition: qcolor.cpp:1106
unsigned char c[8]
Definition: qnumeric_p.h:62
qreal greenF() const
Returns the green color component of this color.
Definition: qcolor.cpp:1241
#define GL_STENCIL_BUFFER_BIT
QPalette::ColorRole backgroundRole() const
Returns the background role of the widget.
Definition: qwidget.cpp:4677
bool autoFillBackground() const
virtual QGLContext * context() const
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
const QPalette & palette() const
#define GL_COLOR_BUFFER_BIT
const QBrush & brush(ColorGroup cg, ColorRole cr) const
Returns the brush in the specified color group, used for the given color role.
Definition: qpalette.cpp:874
#define GL_DEPTH_BUFFER_BIT
virtual void beginPaint()
qreal redF() const
Returns the red color component of this color.
Definition: qcolor.cpp:1213
qreal blueF() const
Returns the blue color component of this color.
Definition: qcolor.cpp:1269

◆ context()

QGLContext * QGLWidgetGLPaintDevice::context ( ) const
virtual

Implements QGLPaintDevice.

Definition at line 200 of file qglpaintdevice.cpp.

201 {
202  return const_cast<QGLContext*>(glWidget->context());
203 }
const QGLContext * context() const
Returns the context of this widget.
Definition: qgl.cpp:5303
The QGLContext class encapsulates an OpenGL rendering context.
Definition: qgl.h:310

◆ endPaint()

void QGLWidgetGLPaintDevice::endPaint ( )
virtual

Reimplemented from QGLPaintDevice.

Definition at line 187 of file qglpaintdevice.cpp.

188 {
189  if (glWidget->autoBufferSwap())
192 }
void swapBuffers()
Swaps the screen contents with an off-screen buffer.
Definition: qgl.cpp:4226
bool autoBufferSwap() const
Returns true if the widget is doing automatic GL buffer swapping; otherwise returns false...
Definition: qgl.cpp:5321
virtual void endPaint()

◆ paintEngine()

QPaintEngine * QGLWidgetGLPaintDevice::paintEngine ( ) const
virtual

Implements QPaintDevice.

Definition at line 159 of file qglpaintdevice.cpp.

160 {
161  return glWidget->paintEngine();
162 }
QPaintEngine * paintEngine() const
Returns the GL widget&#39;s paint engine.
Definition: qgl.cpp:5553

◆ setWidget()

void QGLWidgetGLPaintDevice::setWidget ( QGLWidget w)

Definition at line 164 of file qglpaintdevice.cpp.

165 {
166  glWidget = w;
167 }

◆ size()

QSize QGLWidgetGLPaintDevice::size ( ) const
virtual

Implements QGLPaintDevice.

Definition at line 195 of file qglpaintdevice.cpp.

196 {
197  return glWidget->size();
198 }
QSize size() const

Friends and Related Functions

◆ QGLWidget

friend class QGLWidget
friend

Definition at line 109 of file qglpaintdevice_p.h.

Properties

◆ glWidget

QGLWidget* QGLWidgetGLPaintDevice::glWidget
private

Definition at line 110 of file qglpaintdevice_p.h.


The documentation for this class was generated from the following files: