# QwtPlotCanvas Class Reference

List of all members.

## Detailed Description

Canvas of a QwtPlot.

See also:
  QwtPlot

Definition at line 26 of file qwt_plot_canvas.h.

## Public Types

enum | PaintAttribute { PaintCached = 1, PaintPacked = 2, PaintFiltered = 1, ClipPolygons = 2, PaintUsingTextFont = 1, PaintUsingTextColor = 2, PaintBackground = 4 }
enum | FocusIndicator { NoFocusIndicator, CanvasFocusIndicator, ItemFocusIndicator }

## Public Member Functions

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

## Protected Member Functions

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

## Member Enumeration Documentation

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()

Definition at line 53 of file qwt_plot_canvas.h.

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()

Definition at line 77 of file qwt_plot_canvas.h.

## Constructor & Destructor Documentation

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

Sets a cross cursor, enables QwtPlotCanvas::PaintCached.

Definition at line 50 of file qwt_plot_canvas.cpp.

References setPaintAttribute().

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

Destructor.

Definition at line 75 of file qwt_plot_canvas.cpp.

## Member Function Documentation

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

Return parent plot widget.

Definition at line 81 of file qwt_plot_canvas.cpp.

Referenced by drawContents().

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

Return parent plot widget.

Definition at line 91 of file qwt_plot_canvas.cpp.

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

Set the focus indicator

See also:
  FocusIndicator, focusIndicator

Definition at line 196 of file qwt_plot_canvas.cpp.

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

Returns:
  Focus indicator

See also:
  FocusIndicator, setFocusIndicator

Definition at line 206 of file qwt_plot_canvas.cpp.

Referenced by drawContents().

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()

Definition at line 110 of file qwt_plot_canvas.cpp.

Referenced by QwtPlotCanvas().

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()

Definition at line 167 of file qwt_plot_canvas.cpp.

Referenced by QwtPlotCurve::draw(), and QwtPlot::replot().

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

Return the paint cache, might be null.

Definition at line 173 of file qwt_plot_canvas.cpp.

Referenced by QwtPlotCurve::draw().

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

Return the paint cache, might be null.

Definition at line 179 of file qwt_plot_canvas.cpp.

void QwtPlotCanvas::invalidatePaintCache | ( |  | ) |

Invalidate the internal paint cache.

Definition at line 185 of file qwt_plot_canvas.cpp.

Referenced by QwtPlot::replot().

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

Paint event.

Definition at line 225 of file qwt_plot_canvas.cpp.

References drawContents().

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

Redraw the canvas, and focus rect.

Definition at line 250 of file qwt_plot_canvas.cpp.

References QwtPlot::autoReplot(), drawCanvas(), drawFocusIndicator(), focusIndicator(), plot(), and QwtPlot::setAutoReplot().

Referenced by paintEvent().

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

Draw the focus indication.

Definition at line 350 of file qwt_plot_canvas.cpp.

References QwtPainter::drawFocusRect().

Referenced by drawContents().

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.

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

Definition at line 281 of file qwt_plot_canvas.cpp.

Referenced by drawContents().