Classes | Public Types | Public Slots | Public Member Functions | Protected Member Functions | Properties | Private Member Functions | Private Attributes
QwtPlotCanvas Class Reference

Canvas of a QwtPlot. More...

#include <qwt_plot_canvas.h>

Inheritance diagram for QwtPlotCanvas:
Inheritance graph
[legend]

List of all members.

Classes

class  PrivateData

Public Types

enum  PaintAttribute {
  BackingStore = 1, Opaque = 2, HackStyledBackground = 4, ImmediatePaint = 8,
  OpenGLBuffer = 16
}
 Paint attributes. More...
typedef QFlags< PaintAttributePaintAttributes
 Paint attributes.

Public Slots

void replot ()

Public Member Functions

const QPixmap * backingStore () const
Q_INVOKABLE QPainterPath borderPath (const QRect &) const
virtual bool event (QEvent *)
Q_INVOKABLE void invalidateBackingStore ()
 Invalidate the internal backing store.
 QwtPlotCanvas (QwtPlot *=NULL)
 Constructor.
void setPaintAttribute (PaintAttribute, bool on=true)
 Changing the paint attributes.
bool testPaintAttribute (PaintAttribute) const
virtual ~QwtPlotCanvas ()
 Destructor.

Protected Member Functions

virtual void drawBorder (QPainter *)
virtual void paintEvent (QPaintEvent *)
virtual void resizeEvent (QResizeEvent *)

Properties

double borderRadius

Private Member Functions

QImage toImageFBO (const QSize &size)

Private Attributes

PrivateDatad_data

Detailed Description

Canvas of a QwtPlot.

Canvas is the widget where all plot items are displayed

See also:
QwtPlot::setCanvas(), QwtPlotGLCanvas

Definition at line 28 of file qwt_plot_canvas.h.


Member Typedef Documentation

Paint attributes.

Definition at line 126 of file qwt_plot_canvas.h.


Member Enumeration Documentation

Paint attributes.

The default setting enables BackingStore and Opaque.

See also:
setPaintAttribute(), testPaintAttribute()
Enumerator:
BackingStore 

Paint double buffered reusing the content of the pixmap buffer when possible.

Using a backing store might improve the performance significantly, when working with widget overlays ( like rubber bands ). Disabling the cache might improve the performance for incremental paints (using QwtPlotDirectPainter ).

See also:
backingStore(), invalidateBackingStore()
Opaque 

Try to fill the complete contents rectangle of the plot canvas.

When using styled backgrounds Qt assumes, that the canvas doesn't fill its area completely ( f.e because of rounded borders ) and fills the area below the canvas. When this is done with gradients it might result in a serious performance bottleneck - depending on the size.

When the Opaque attribute is enabled the canvas tries to identify the gaps with some heuristics and to fill those only.

Warning:
Will not work for semitransparent backgrounds
HackStyledBackground 

Try to improve painting of styled backgrounds.

QwtPlotCanvas supports the box model attributes for customizing the layout with style sheets. Unfortunately the design of Qt style sheets has no concept how to handle backgrounds with rounded corners - beside of padding.

When HackStyledBackground is enabled the plot canvas tries to separate the background from the background border by reverse engineering to paint the background before and the border after the plot items. In this order the border gets perfectly antialiased and you can avoid some pixel artifacts in the corners.

ImmediatePaint 

When ImmediatePaint is set replot() calls repaint() instead of update().

See also:
replot(), QWidget::repaint(), QWidget::update()
OpenGLBuffer 

Render the canvas via an OpenGL buffer.

In OpenGLBuffer mode the plot scene will be rendered to a temporary OpenGL buffer, that will be translated to a QImage afterwards. Then this image will be painted to the canvas.

This mode might be useful for "heavy" plots to achieve hardware acceleration on platforms, where the raster paint engine ( = software renderer ) would be used otherwise. But the penalty for copying out the buffer to the image makes this mode less optimal when looking for high refresh rates of a "lightweight" plot.

On a hardware accelerated graphics system ( f.e. Qt4/X11 "native" ) using this mode does not make much sense. Unfortunately those systems have been removed from Qt5.

Note:
The OpenGLBuffer mode has no effect, when "QwtOpenGL" has been disabled in qwtconfig.pri.
See also:
QwtPlotOpenGLCanvas, QwtPlotGLCanvas

Definition at line 43 of file qwt_plot_canvas.h.


Constructor & Destructor Documentation

QwtPlotCanvas::QwtPlotCanvas ( QwtPlot plot = NULL) [explicit]

Constructor.

Parameters:
plotParent plot widget
See also:
QwtPlot::setCanvas()

Definition at line 90 of file qwt_plot_canvas.cpp.

Destructor.

Definition at line 102 of file qwt_plot_canvas.cpp.


Member Function Documentation

const QPixmap * QwtPlotCanvas::backingStore ( ) const
Returns:
Backing store, might be null

Definition at line 178 of file qwt_plot_canvas.cpp.

QPainterPath QwtPlotCanvas::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:
rectBounding rectangle of the canvas
Returns:
Painter path, that can be used for clipping

Definition at line 383 of file qwt_plot_canvas.cpp.

void QwtPlotCanvas::drawBorder ( QPainter *  painter) [protected, virtual]

Draw the border of the plot canvas

Parameters:
painterPainter
See also:
setBorderRadius()

Reimplemented from QwtPlotAbstractCanvas.

Definition at line 337 of file qwt_plot_canvas.cpp.

bool QwtPlotCanvas::event ( QEvent *  event) [virtual]

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

Parameters:
eventQt Event
Returns:
See QFrame::event()

Definition at line 196 of file qwt_plot_canvas.cpp.

Invalidate the internal backing store.

Definition at line 184 of file qwt_plot_canvas.cpp.

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

Paint event

Parameters:
eventPaint event

Definition at line 223 of file qwt_plot_canvas.cpp.

void QwtPlotCanvas::replot ( ) [slot]

Invalidate the paint cache and repaint the canvas

See also:
invalidatePaintCache()

Definition at line 364 of file qwt_plot_canvas.cpp.

void QwtPlotCanvas::resizeEvent ( QResizeEvent *  event) [protected, virtual]

Resize event

Parameters:
eventResize event

Definition at line 354 of file qwt_plot_canvas.cpp.

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

Changing the paint attributes.

Parameters:
attributePaint attribute
onOn/Off
See also:
testPaintAttribute(), backingStore()

Definition at line 115 of file qwt_plot_canvas.cpp.

Test whether a paint attribute is enabled

Parameters:
attributePaint attribute
Returns:
true, when attribute is enabled
See also:
setPaintAttribute()

Definition at line 172 of file qwt_plot_canvas.cpp.

QImage QwtPlotCanvas::toImageFBO ( const QSize &  size) [private]

Definition at line 392 of file qwt_plot_canvas.cpp.


Member Data Documentation

Reimplemented from QwtPlotAbstractCanvas.

Definition at line 153 of file qwt_plot_canvas.h.


Property Documentation

double QwtPlotCanvas::borderRadius [read, write]

Definition at line 32 of file qwt_plot_canvas.h.


The documentation for this class was generated from the following files:


plotjuggler
Author(s): Davide Faconti
autogenerated on Wed Jul 3 2019 19:28:06