Qwt User's Guide 6.3.0

Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
QwtPlotDirectPainter Class Reference

Painter object trying to paint incrementally. More...

`#include <qwt_plot_directpainter.h>`

Inheritance diagram for QwtPlotDirectPainter:

## Public Types
enum | Attribute { AtomicPainter = 0x01 , FullRepaint = 0x02 , CopyBackingStore = 0x04 }
| Paint attributes. More...
typedef QFlags< Attribute > | Attributes

## Public Member Functions
| QwtPlotDirectPainter (QObject *parent=NULL)
| Constructor.
virtual | ~QwtPlotDirectPainter ()
| Destructor.
void | setAttribute (Attribute, bool on)
bool | testAttribute (Attribute) const
void | setClipping (bool)
bool | hasClipping () const
void | setClipRegion (const QRegion &)
| Assign a clip region and enable clipping.
QRegion | clipRegion () const
void | drawSeries (QwtPlotSeriesItem *, int from, int to)
| Draw a set of points of a seriesItem.
void | reset ()
| Close the internal QPainter.
virtual bool | eventFilter (QObject *, QEvent *) override
| Event filter.

## Detailed Description

Painter object trying to paint incrementally.

Often applications want to display samples while they are collected. When there are too many samples complete replots will be expensive to be processed in a collection cycle.

QwtPlotDirectPainter offers an API to paint subsets ( f.e all additions points ) without erasing/repainting the plot canvas.

On certain environments it might be important to calculate a proper clip region before painting. F.e. for Qt Embedded only the clipped part of the backing store will be copied to a ( maybe unaccelerated ) frame buffer.

Warning
  Incremental painting will only help when no replot is triggered by another operation ( like changing scales ) and nothing needs to be erased.

Definition at line 39 of file qwt_plot_directpainter.h.

## Member Typedef Documentation

## ◆ Attributes

typedef QFlags<Attribute > QwtPlotDirectPainter::Attributes

An ORed combination of Attribute values.

Definition at line 73 of file qwt_plot_directpainter.h.

## Member Enumeration Documentation

## ◆ Attribute

enum QwtPlotDirectPainter::Attribute

Paint attributes.

See also
  setAttribute(), testAttribute(), drawSeries()

Enumerator
AtomicPainter | Initializing a QPainter is an expensive operation. When AtomicPainter is set each call of drawSeries() opens/closes a temporary QPainter. Otherwise QwtPlotDirectPainter tries to use the same QPainter as long as possible.
FullRepaint | When FullRepaint is set the plot canvas is explicitly repainted after the samples have been rendered.
CopyBackingStore | When QwtPlotCanvas::BackingStore is enabled the painter has to paint to the backing store and the widget. In certain situations/environments it might be faster to paint to the backing store only and then copy the backing store to the canvas. This flag can also be useful for settings, where Qt fills the the clip region with the widget background.

Definition at line 46 of file qwt_plot_directpainter.h.

## Constructor & Destructor Documentation

## ◆ QwtPlotDirectPainter()

QwtPlotDirectPainter::QwtPlotDirectPainter | ( | QObject * | parent = NULL | ) |
| explicit

Constructor.

Definition at line 66 of file qwt_plot_directpainter.cpp.

## ◆ ~QwtPlotDirectPainter()

QwtPlotDirectPainter::~QwtPlotDirectPainter | ( |  | ) |
| virtual

Destructor.

Definition at line 73 of file qwt_plot_directpainter.cpp.

## Member Function Documentation

## ◆ clipRegion()

QRegion QwtPlotDirectPainter::clipRegion | ( |  | ) | const

Returns
  Currently set clip region.

See also
  setClipRegion(), setClipping(), hasClipping()

Definition at line 151 of file qwt_plot_directpainter.cpp.

## ◆ drawSeries()

void QwtPlotDirectPainter::drawSeries | ( | QwtPlotSeriesItem * | seriesItem,
|  | int | from,
|  | int | to )

Draw a set of points of a seriesItem.

When observing an measurement while it is running, new points have to be added to an existing seriesItem. drawSeries() can be used to display them avoiding a complete redraw of the canvas.

Setting plot()->canvas()->setAttribute(Qt::WA_PaintOutsidePaintEvent, true); will result in faster painting, if the paint engine of the canvas widget supports this feature.

Parameters

  seriesItem | Item to be painted
  from | Index of the first point to be painted
  to | Index of the last point to be painted. If to < 0 the series will be painted to its last point.

Definition at line 172 of file qwt_plot_directpainter.cpp.

## ◆ eventFilter()

bool QwtPlotDirectPainter::eventFilter | ( | QObject * | ,
|  | QEvent * | event )
| override virtual

Event filter.

Definition at line 277 of file qwt_plot_directpainter.cpp.

## ◆ hasClipping()

bool QwtPlotDirectPainter::hasClipping | ( |  | ) | const

Returns
  true, when clipping is enabled

See also
  setClipping(), clipRegion(), setClipRegion()

Definition at line 125 of file qwt_plot_directpainter.cpp.

## ◆ reset()

void QwtPlotDirectPainter::reset | ( |  | ) |

Close the internal QPainter.

Definition at line 264 of file qwt_plot_directpainter.cpp.

## ◆ setAttribute()

void QwtPlotDirectPainter::setAttribute | ( | Attribute | attribute,
|  | bool | on )

Change an attribute

Parameters

  attribute | Attribute to change
  on | On/Off

See also
  Attribute, testAttribute()

Definition at line 86 of file qwt_plot_directpainter.cpp.

## ◆ setClipping()

void QwtPlotDirectPainter::setClipping | ( | bool | enable | ) |

En/Disables clipping

Parameters

  enable | Enables clipping is true, disable it otherwise

See also
  hasClipping(), clipRegion(), setClipRegion()

Definition at line 116 of file qwt_plot_directpainter.cpp.

## ◆ setClipRegion()

void QwtPlotDirectPainter::setClipRegion | ( | const QRegion & | region | ) |

Assign a clip region and enable clipping.

Depending on the environment setting a proper clip region might improve the performance heavily. F.e. on Qt embedded only the clipped part of the backing store will be copied to a ( maybe unaccelerated ) frame buffer device.

Parameters

  region | Clip region

See also
  clipRegion(), hasClipping(), setClipping()

Definition at line 141 of file qwt_plot_directpainter.cpp.

## ◆ testAttribute()

bool QwtPlotDirectPainter::testAttribute | ( | Attribute | attribute | ) | const

Returns
  True, when attribute is enabled

Parameters

  attribute | Attribute to be tested

See also
  Attribute, setAttribute()

Definition at line 105 of file qwt_plot_directpainter.cpp.