QwtPlotDirectPainter

class qwt.plot_directpainter.QwtPlotDirectPainter(parent=None)[source]

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.

Paint attributes:

  • QwtPlotDirectPainter.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.

  • QwtPlotDirectPainter.FullRepaint:

    When FullRepaint is set the plot canvas is explicitly repainted after the samples have been rendered.

  • QwtPlotDirectPainter.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.

setAttribute(attribute, on=True)[source]

Change an attribute

Parameters:
  • attribute (int) – Attribute to change
  • on (bool) – On/Off

See also

testAttribute()

testAttribute(attribute)[source]
Parameters:attribute (int) – Attribute to be tested
Returns:True, when attribute is enabled

See also

setAttribute()

setClipping(enable)[source]

En/Disables clipping

Parameters:enable (bool) – Enables clipping is true, disable it otherwise
hasClipping()[source]
Returns:Return true, when clipping is enabled
setClipRegion(region)[source]

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 (QRegion) – Clip region
clipRegion()[source]
Returns:Return Currently set clip region.
drawSeries(seriesItem, from_, to)[source]

Draw a set of points of a seriesItem.

When observing a 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 (qwt.plot_seriesitem.QwtPlotSeriesItem) – Item to be painted
  • from (int) – Index of the first point to be painted
  • to (int) – Index of the last point to be painted. If to < 0 the series will be painted to its last point.
reset()[source]

Close the internal QPainter

class qwt.plot_directpainter.QwtPlotDirectPainter(parent=None)[source]

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.

Paint attributes:

  • QwtPlotDirectPainter.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.

  • QwtPlotDirectPainter.FullRepaint:

    When FullRepaint is set the plot canvas is explicitly repainted after the samples have been rendered.

  • QwtPlotDirectPainter.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.

setAttribute(attribute, on=True)[source]

Change an attribute

Parameters:
  • attribute (int) – Attribute to change
  • on (bool) – On/Off

See also

testAttribute()

testAttribute(attribute)[source]
Parameters:attribute (int) – Attribute to be tested
Returns:True, when attribute is enabled

See also

setAttribute()

setClipping(enable)[source]

En/Disables clipping

Parameters:enable (bool) – Enables clipping is true, disable it otherwise
hasClipping()[source]
Returns:Return true, when clipping is enabled
setClipRegion(region)[source]

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 (QRegion) – Clip region
clipRegion()[source]
Returns:Return Currently set clip region.
drawSeries(seriesItem, from_, to)[source]

Draw a set of points of a seriesItem.

When observing a 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 (qwt.plot_seriesitem.QwtPlotSeriesItem) – Item to be painted
  • from (int) – Index of the first point to be painted
  • to (int) – Index of the last point to be painted. If to < 0 the series will be painted to its last point.
reset()[source]

Close the internal QPainter