# QwtPlotCanvas Class Reference

Canvas of a QwtPlot. More...

`#include <qwt_plot_canvas.h>`

List of all members.

## Public Types

enum | FocusIndicator { NoFocusIndicator, CanvasFocusIndicator, ItemFocusIndicator }
enum | PaintAttribute { PaintCached = 1, PaintPacked = 2 }

## Public Member Functions

FocusIndicator | focusIndicator () const
void | invalidatePaintCache ()
QPixmap * | paintCache ()
const QPixmap * | paintCache () const
const QwtPlot * | plot () const
QwtPlot * | plot ()
| QwtPlotCanvas (QwtPlot *)
void | replot ()
void | setFocusIndicator (FocusIndicator)
void | setPaintAttribute (PaintAttribute, bool on=true)
bool | testPaintAttribute (PaintAttribute) const
virtual | ~QwtPlotCanvas ()

## Protected Member Functions

void | drawCanvas (QPainter *painter=NULL)
virtual void | drawContents (QPainter *)
virtual void | drawFocusIndicator (QPainter *)
virtual void | hideEvent (QHideEvent *)
virtual void | paintEvent (QPaintEvent *)

## Detailed Description

Canvas of a QwtPlot.

See also:
  QwtPlot

## Member Enumeration Documentation

enum QwtPlotCanvas::FocusIndicator

Focus indicator.

- NoFocusIndicator
  Don't paint a focus indicator

- CanvasFocusIndicator
  The focus is related to the complete canvas. Paint the focus indicator using paintFocus()

- ItemFocusIndicator
  The focus is related to an item (curve, point, ...) on the canvas. It is up to the application to display a focus indication using f.e. highlighting.

See also:
  setFocusIndicator(), focusIndicator(), paintFocus()

enum QwtPlotCanvas::PaintAttribute

Paint attributes.

- PaintCached
  Paint double buffered and reuse the content of the pixmap buffer for some spontaneous repaints that happen when a plot gets unhidden, deiconified or changes the focus. Disabling the cache will improve the performance for incremental paints (using QwtPlotCurve::draw).

- PaintPacked
  Suppress system background repaints and paint it together with the canvas contents. Painting packed might avoid flickering for expensive repaints, when there is a notable gap between painting the background and the plot contents.

The default setting enables PaintCached and PaintPacked

See also:
  setPaintAttribute(), testPaintAttribute(), paintCache()

## Constructor & Destructor Documentation

QwtPlotCanvas::QwtPlotCanvas | ( | QwtPlot * | plot | ) | `[explicit]`

Sets a cross cursor, enables QwtPlotCanvas::PaintCached.

QwtPlotCanvas::~QwtPlotCanvas | ( |  | ) | `[virtual]`

Destructor.

## Member Function Documentation

void QwtPlotCanvas::drawCanvas | ( | QPainter * | painter = `NULL` | ) | `[protected]`

Draw the the canvas

Paints all plot items to the contentsRect(), using QwtPlot::drawCanvas and updates the paint cache.

Parameters:

  painter | Painter

See also:
  QwtPlot::drawCanvas(), setPaintAttributes(), testPaintAttributes()

void QwtPlotCanvas::drawContents | ( | QPainter * | painter | ) | `[protected, virtual]`

Redraw the canvas, and focus rect

Parameters:

  painter | Painter

void QwtPlotCanvas::drawFocusIndicator | ( | QPainter * | painter | ) | `[protected, virtual]`

Draw the focus indication

Parameters:

  painter | Painter

QwtPlotCanvas::FocusIndicator QwtPlotCanvas::focusIndicator | ( |  | ) | const

Returns:
  Focus indicator

See also:
  FocusIndicator, setFocusIndicator()

void QwtPlotCanvas::hideEvent | ( | QHideEvent * | event | ) | `[protected, virtual]`

Hide event

Parameters:

  event | Hide event

void QwtPlotCanvas::invalidatePaintCache | ( |  | ) |

Invalidate the internal paint cache.

const QPixmap * QwtPlotCanvas::paintCache | ( |  | ) | const

Return the paint cache, might be null.

QPixmap * QwtPlotCanvas::paintCache | ( |  | ) |

Return the paint cache, might be null.

void QwtPlotCanvas::paintEvent | ( | QPaintEvent * | event | ) | `[protected, virtual]`

Paint event

Parameters:

  event | Paint event

const QwtPlot * QwtPlotCanvas::plot | ( |  | ) | const

Return parent plot widget.

QwtPlot * QwtPlotCanvas::plot | ( |  | ) |

Return parent plot widget.

void QwtPlotCanvas::replot | ( |  | ) |

Invalidate the paint cache and repaint the canvas

See also:
  invalidatePaintCache()

void QwtPlotCanvas::setFocusIndicator | ( | FocusIndicator | focusIndicator | ) |

Set the focus indicator

See also:
  FocusIndicator, focusIndicator()

void QwtPlotCanvas::setPaintAttribute | ( | PaintAttribute | attribute,
|  | bool | on = `true`
| ) |  |

Changing the paint attributes.

Parameters:

  attribute | Paint attribute
  on | On/Off

The default setting enables PaintCached and PaintPacked

See also:
  testPaintAttribute(), drawCanvas(), drawContents(), paintCache()

bool QwtPlotCanvas::testPaintAttribute | ( | PaintAttribute | attribute | ) | const

Test wether a paint attribute is enabled

Parameters:

  attribute | Paint attribute

Returns:
  true if the attribute is enabled

See also:
  setPaintAttribute()