QwtPlotCanvas - Canvas of a QwtPlot.
Contents
Constructor & Destructor Documentation
QwtPlotCanvas::QwtPlotCanvas(QwtPlot*plot=NULL)[explicit]
Constructor.
Parameters:plot Parent plot widget
Seealso:QwtPlot::setCanvas()Detailed Description
Canvas of a QwtPlot.
Canvas is the widget where all plot items are displayed
Seealso:QwtPlot::setCanvas(), QwtPlotGLCanvasMember Enumeration Documentation
enumQwtPlotCanvas::FocusIndicator
Focus indicator The default setting is NoFocusIndicator.
Seealso:setFocusIndicator(), focusIndicator(), drawFocusIndicator()EnumeratorNoFocusIndicator
Don't paint a focus indicator.
CanvasFocusIndicator
The focus is related to the complete canvas. Paint the focus indicator using drawFocusIndicator()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.
enumQwtPlotCanvas::PaintAttribute
Paint attributes. The default setting enables BackingStore and Opaque.
Seealso:setPaintAttribute(), testPaintAttribute()EnumeratorBackingStore
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 ).
Seealso: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().
Seealso:replot(), QWidget::repaint(), QWidget::update()
Member Function Documentation
constQPixmap*QwtPlotCanvas::backingStore()constReturns:
Backing store, might be null
QPainterPathQwtPlotCanvas::borderPath(constQRect&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:rect Bounding rectangle of the canvas
Returns:
Painter path, that can be used for clipping
doubleQwtPlotCanvas::borderRadius()constReturns:
Radius for the corners of the border frame
Seealso:setBorderRadius()voidQwtPlotCanvas::drawBorder(QPainter*painter)[protected],[virtual]
Draw the border of the plot canvas
Parameters:painter Painter
Seealso:setBorderRadius()voidQwtPlotCanvas::drawFocusIndicator(QPainter*painter)[protected],[virtual]
Draw the focus indication
Parameters:painter Painter
boolQwtPlotCanvas::event(QEvent*event)[virtual]
Qt event handler for QEvent::PolishRequest and QEvent::StyleChange
Parameters:event Qt Event
Returns:
See QFrame::event()
QwtPlotCanvas::FocusIndicatorQwtPlotCanvas::focusIndicator()constReturns:
Focus indicator
Seealso:FocusIndicator, setFocusIndicator()voidQwtPlotCanvas::paintEvent(QPaintEvent*event)[protected],[virtual]
Paint event
Parameters:event Paint event
voidQwtPlotCanvas::replot()[slot]
Invalidate the paint cache and repaint the canvas
Seealso:
invalidatePaintCache()
voidQwtPlotCanvas::resizeEvent(QResizeEvent*event)[protected],[virtual]
Resize event
Parameters:event Resize event
voidQwtPlotCanvas::setBorderRadius(doubleradius)
Set the radius for the corners of the border frame
Parameters:radius Radius of a rounded corner
Seealso:borderRadius()voidQwtPlotCanvas::setFocusIndicator(FocusIndicatorfocusIndicator)
Set the focus indicator
Seealso:FocusIndicator, focusIndicator()voidQwtPlotCanvas::setPaintAttribute(PaintAttributeattribute,boolon=true)
Changing the paint attributes.
Parameters:attribute Paint attribute
on On/Off
Seealso:testPaintAttribute(), backingStore()boolQwtPlotCanvas::testPaintAttribute(PaintAttributeattribute)const
Test whether a paint attribute is enabled
Parameters:attribute Paint attribute
Returns:
true, when attribute is enabled
Seealso:setPaintAttribute()Name
QwtPlotCanvas - Canvas of a QwtPlot.
Synopsis
#include <qwt_plot_canvas.h>
Inherits QFrame.
PublicTypes
enum PaintAttribute { BackingStore = 1, Opaque = 2, HackStyledBackground = 4, ImmediatePaint = 8 }
Paint attributes.
enum FocusIndicator { NoFocusIndicator, CanvasFocusIndicator, ItemFocusIndicator }
Focus indicator The default setting is NoFocusIndicator.
typedef QFlags< PaintAttribute > PaintAttributes
Paint attributes.
PublicSlots
void replot ()
PublicMemberFunctionsQwtPlotCanvas (QwtPlot *=NULL)
Constructor.
virtual ~QwtPlotCanvas ()
Destructor.
QwtPlot * plot ()
Return parent plot widget.
const QwtPlot * plot () const
Return parent plot widget.
void setFocusIndicator (FocusIndicator)
FocusIndicatorfocusIndicator () const
void setBorderRadius (double)
double borderRadius () const
void setPaintAttribute (PaintAttribute, bool on=true)
Changing the paint attributes.
bool testPaintAttribute (PaintAttribute) const
const QPixmap * backingStore () const
void invalidateBackingStore ()
Invalidate the internal backing store.
virtual bool event (QEvent *)
Q_INVOKABLE QPainterPath borderPath (const QRect &) const
ProtectedMemberFunctions
virtual void paintEvent (QPaintEvent *)
virtual void resizeEvent (QResizeEvent *)
virtual void drawFocusIndicator (QPainter *)
virtual void drawBorder (QPainter *)
void updateStyleSheetInfo ()
Update the cached information about the current style sheet.
