Loading...
Searching...
No Matches
QwtPlotGLCanvas Class Reference

An alternative canvas for a QwtPlot derived from QGLWidget. More...

`#include <qwt_plot_glcanvas.h>`

Inheritance diagram for QwtPlotGLCanvas:

## Public Slots

void | replot ()

## Public Member Functions

| QwtPlotGLCanvas (QwtPlot *=NULL)
| Constructor.
| QwtPlotGLCanvas (const QGLFormat &, QwtPlot *=NULL)
| Constructor.
virtual | ~QwtPlotGLCanvas ()
| Destructor.
virtual Q_INVOKABLE void | invalidateBackingStore () override
| Invalidate the internal backing store.
Q_INVOKABLE QPainterPath | borderPath (const QRect &) const
virtual bool | event (QEvent *) override
Public Member Functions inherited from QwtPlotAbstractGLCanvas
| QwtPlotAbstractGLCanvas (QWidget *canvasWidget)
| Constructor.
virtual | ~QwtPlotAbstractGLCanvas ()
| Destructor.
void | setPaintAttribute (PaintAttribute, bool on=true)
| Changing the paint attributes.
bool | testPaintAttribute (PaintAttribute) const
void | setFrameStyle (int style)
int | frameStyle () const
void | setFrameShadow (QFrame::Shadow)
QFrame::Shadow | frameShadow () const
void | setFrameShape (QFrame::Shape)
QFrame::Shape | frameShape () const
void | setLineWidth (int)
int | lineWidth () const
void | setMidLineWidth (int)
int | midLineWidth () const
int | frameWidth () const
QRect | frameRect () const
Public Member Functions inherited from QwtPlotAbstractCanvas
| QwtPlotAbstractCanvas (QWidget *canvasWidget)
| Constructor.
virtual | ~QwtPlotAbstractCanvas ()
| Destructor.
QwtPlot * | plot ()
| Return parent plot widget.
const QwtPlot * | plot () const
| Return parent plot widget.
void | setFocusIndicator (FocusIndicator)
FocusIndicator | focusIndicator () const
void | setBorderRadius (double)
double | borderRadius () const

## Protected Member Functions

virtual void | paintEvent (QPaintEvent *) override
virtual void | initializeGL () override
| No operation - reserved for some potential use in the future.
virtual void | paintGL () override
| Paint the plot.
virtual void | resizeGL (int width, int height) override
| No operation - reserved for some potential use in the future.
Protected Member Functions inherited from QwtPlotAbstractGLCanvas
void | replot ()
void | draw (QPainter *)
| Helper function for the derived plot canvas.
Protected Member Functions inherited from QwtPlotAbstractCanvas
QWidget * | canvasWidget ()
const QWidget * | canvasWidget () const
virtual void | drawFocusIndicator (QPainter *)
virtual void | drawBorder (QPainter *)
virtual void | drawBackground (QPainter *)
| Helper function for the derived plot canvas.
void | fillBackground (QPainter *)
| Helper function for the derived plot canvas.
void | drawCanvas (QPainter *)
| Draw the plot to the canvas.
void | drawStyled (QPainter *, bool)
| Helper function for the derived plot canvas.
void | drawUnstyled (QPainter *)
| Helper function for the derived plot canvas.
QPainterPath | canvasBorderPath (const QRect &rect) const
void | updateStyleSheetInfo ()
| Update the cached information about the current style sheet.

## Additional Inherited Members

Public Types inherited from QwtPlotAbstractGLCanvas
enum | PaintAttribute { BackingStore = 1 , ImmediatePaint = 8 }
| Paint attributes. More...
typedef QFlags< PaintAttribute > | PaintAttributes
| Paint attributes.
Public Types inherited from QwtPlotAbstractCanvas
enum | FocusIndicator { NoFocusIndicator , CanvasFocusIndicator , ItemFocusIndicator }
| Focus indicator The default setting is NoFocusIndicator. More...

## Detailed Description

An alternative canvas for a QwtPlot derived from QGLWidget.

QwtPlotGLCanvas implements the very basics to act as canvas inside of a QwtPlot widget. It might be extended to a full featured alternative to QwtPlotCanvas in a future version of Qwt.

Even if QwtPlotGLCanvas is not derived from QFrame it imitates its API. When using style sheets it supports the box model - beside backgrounds with rounded borders.

Since Qt 5.4 QOpenGLWidget is available, that is used by QwtPlotOpenGLCanvas.

See also
  QwtPlot::setCanvas(), QwtPlotCanvas, QwtPlotOpenGLCanvas

Note
  With Qt4 you might want to use the QPaintEngine::OpenGL paint engine ( see QGL::setPreferredPaintEngine() ). On a Linux test system QPaintEngine::OpenGL2 shows very basic problems like translated geometries.
  Another way for getting hardware accelerated graphics is using an OpenGL offscreen buffer ( QwtPlotCanvas::OpenGLBuffer ) with QwtPlotCanvas. Performance is worse, than rendering straight to a QGLWidget, but is usually better integrated into a desktop application.

Definition at line 45 of file qwt_plot_glcanvas.h.

## Constructor & Destructor Documentation

## QwtPlotGLCanvas() [1/2]

QwtPlotGLCanvas::QwtPlotGLCanvas | ( | QwtPlot * | plot = NULL | ) |

explicit

Constructor.

Parameters

  plot | Parent plot widget

See also
  QwtPlot::setCanvas()

Definition at line 56 of file qwt_plot_glcanvas.cpp.

## QwtPlotGLCanvas() [2/2]

QwtPlotGLCanvas::QwtPlotGLCanvas | ( | const QGLFormat & | format,
|  | QwtPlot * | plot = NULL )

explicit

Constructor.

Parameters

  format | OpenGL rendering options
  plot | Parent plot widget

See also
  QwtPlot::setCanvas()

Definition at line 69 of file qwt_plot_glcanvas.cpp.

## ~QwtPlotGLCanvas()

QwtPlotGLCanvas::~QwtPlotGLCanvas | ( |  | ) |

virtual

Destructor.

Definition at line 77 of file qwt_plot_glcanvas.cpp.

## Member Function Documentation

## borderPath()

QPainterPath QwtPlotGLCanvas::borderPath | ( | const QRect & | rect | ) | const

Calculate the painter path for a styled or rounded border

When the canvas has no styled background or rounded borders the painter path is empty.

Parameters

  rect | Bounding rectangle of the canvas

Returns
  Painter path, that can be used for clipping

Definition at line 157 of file qwt_plot_glcanvas.cpp.

## clearBackingStore()

void QwtPlotGLCanvas::clearBackingStore | ( |  | ) |

overrideprivatevirtual

Implements QwtPlotAbstractGLCanvas.

Definition at line 142 of file qwt_plot_glcanvas.cpp.

## event()

bool QwtPlotGLCanvas::event | ( | QEvent * | event | ) |

overridevirtual

Qt event handler for QEvent::PolishRequest and QEvent::StyleChange

Parameters

  event | Qt Event

Returns
  See QGLWidget::event()

Definition at line 110 of file qwt_plot_glcanvas.cpp.

## initializeGL()

void QwtPlotGLCanvas::initializeGL | ( |  | ) |

overrideprotectedvirtual

No operation - reserved for some potential use in the future.

Definition at line 163 of file qwt_plot_glcanvas.cpp.

## invalidateBackingStore()

void QwtPlotGLCanvas::invalidateBackingStore | ( |  | ) |

overridevirtual

Invalidate the internal backing store.

Implements QwtPlotAbstractGLCanvas.

Definition at line 137 of file qwt_plot_glcanvas.cpp.

## paintEvent()

void QwtPlotGLCanvas::paintEvent | ( | QPaintEvent * | event | ) |

overrideprotectedvirtual

Paint event

Parameters

  event | Paint event

See also
  QwtPlot::drawCanvas()

Definition at line 100 of file qwt_plot_glcanvas.cpp.

## paintGL()

void QwtPlotGLCanvas::paintGL | ( |  | ) |

overrideprotectedvirtual

Paint the plot.

Definition at line 168 of file qwt_plot_glcanvas.cpp.

## replot

void QwtPlotGLCanvas::replot | ( |  | ) |

slot

Invalidate the paint cache and repaint the canvas

See also
  invalidatePaintCache()

Definition at line 131 of file qwt_plot_glcanvas.cpp.

## resizeGL()

void QwtPlotGLCanvas::resizeGL | ( | int | width,
|  | int | height )

overrideprotectedvirtual

No operation - reserved for some potential use in the future.

Definition at line 233 of file qwt_plot_glcanvas.cpp.