#include <qwt_plot_canvas.h>
Classes | |
class | PrivateData |
Public Types | |
enum | FocusIndicator { NoFocusIndicator, CanvasFocusIndicator, ItemFocusIndicator } |
Focus indicator The default setting is NoFocusIndicator. More... | |
enum | PaintAttribute { BackingStore = 1, Opaque = 2, HackStyledBackground = 4, ImmediatePaint = 8 } |
Paint attributes. More... | |
typedef QFlags< PaintAttribute > | PaintAttributes |
Paint attributes. | |
Public Slots | |
void | replot () |
Public Member Functions | |
const QPixmap * | backingStore () const |
Q_INVOKABLE QPainterPath | borderPath (const QRect &) const |
double | borderRadius () const |
virtual bool | event (QEvent *) |
FocusIndicator | focusIndicator () const |
void | invalidateBackingStore () |
Invalidate the internal backing store. | |
QwtPlot * | plot () |
Return parent plot widget. | |
const QwtPlot * | plot () const |
Return parent plot widget. | |
QwtPlotCanvas (QwtPlot *=NULL) | |
Constructor. | |
void | setBorderRadius (double) |
void | setFocusIndicator (FocusIndicator) |
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 | drawFocusIndicator (QPainter *) |
virtual void | paintEvent (QPaintEvent *) |
virtual void | resizeEvent (QResizeEvent *) |
void | updateStyleSheetInfo () |
Update the cached information about the current style sheet. | |
Properties | |
double | borderRadius |
Private Member Functions | |
void | drawCanvas (QPainter *, bool withBackground) |
Private Attributes | |
PrivateData * | d_data |
Canvas of a QwtPlot.
Canvas is the widget where all plot items are displayed
Definition at line 27 of file qwt_plot_canvas.h.
typedef QFlags<PaintAttribute> QwtPlotCanvas::PaintAttributes |
Paint attributes.
Definition at line 101 of file qwt_plot_canvas.h.
Focus indicator The default setting is NoFocusIndicator.
NoFocusIndicator |
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. |
Definition at line 109 of file qwt_plot_canvas.h.
Paint attributes.
The default setting enables BackingStore and Opaque.
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 ).
|
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.
|
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().
|
Definition at line 42 of file qwt_plot_canvas.h.
QwtPlotCanvas::QwtPlotCanvas | ( | QwtPlot * | plot = NULL | ) | [explicit] |
Constructor.
plot | Parent plot widget |
Definition at line 529 of file qwt_plot_canvas.cpp.
QwtPlotCanvas::~QwtPlotCanvas | ( | ) | [virtual] |
Destructor.
Definition at line 548 of file qwt_plot_canvas.cpp.
const QPixmap * QwtPlotCanvas::backingStore | ( | ) | const |
Definition at line 637 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.
rect | Bounding rectangle of the canvas |
Definition at line 1069 of file qwt_plot_canvas.cpp.
double QwtPlotCanvas::borderRadius | ( | ) | const |
void QwtPlotCanvas::drawBorder | ( | QPainter * | painter | ) | [protected, virtual] |
Draw the border of the plot canvas
painter | Painter |
Definition at line 926 of file qwt_plot_canvas.cpp.
void QwtPlotCanvas::drawCanvas | ( | QPainter * | painter, |
bool | withBackground | ||
) | [private] |
Definition at line 817 of file qwt_plot_canvas.cpp.
void QwtPlotCanvas::drawFocusIndicator | ( | QPainter * | painter | ) | [protected, virtual] |
Draw the focus indication
painter | Painter |
Definition at line 1000 of file qwt_plot_canvas.cpp.
bool QwtPlotCanvas::event | ( | QEvent * | event | ) | [virtual] |
Qt event handler for QEvent::PolishRequest and QEvent::StyleChange
event | Qt Event |
Definition at line 695 of file qwt_plot_canvas.cpp.
Definition at line 664 of file qwt_plot_canvas.cpp.
Invalidate the internal backing store.
Definition at line 643 of file qwt_plot_canvas.cpp.
void QwtPlotCanvas::paintEvent | ( | QPaintEvent * | event | ) | [protected, virtual] |
QwtPlot * QwtPlotCanvas::plot | ( | ) |
Return parent plot widget.
Definition at line 554 of file qwt_plot_canvas.cpp.
const QwtPlot * QwtPlotCanvas::plot | ( | ) | const |
Return parent plot widget.
Definition at line 560 of file qwt_plot_canvas.cpp.
void QwtPlotCanvas::replot | ( | ) | [slot] |
Invalidate the paint cache and repaint the canvas
Definition at line 1015 of file qwt_plot_canvas.cpp.
void QwtPlotCanvas::resizeEvent | ( | QResizeEvent * | event | ) | [protected, virtual] |
void QwtPlotCanvas::setBorderRadius | ( | double | radius | ) |
Set the radius for the corners of the border frame
radius | Radius of a rounded corner |
Definition at line 675 of file qwt_plot_canvas.cpp.
void QwtPlotCanvas::setFocusIndicator | ( | FocusIndicator | focusIndicator | ) |
Set the focus indicator
Definition at line 654 of file qwt_plot_canvas.cpp.
void QwtPlotCanvas::setPaintAttribute | ( | PaintAttribute | attribute, |
bool | on = true |
||
) |
Changing the paint attributes.
attribute | Paint attribute |
on | On/Off |
Definition at line 573 of file qwt_plot_canvas.cpp.
bool QwtPlotCanvas::testPaintAttribute | ( | PaintAttribute | attribute | ) | const |
Test whether a paint attribute is enabled
attribute | Paint attribute |
Definition at line 631 of file qwt_plot_canvas.cpp.
void QwtPlotCanvas::updateStyleSheetInfo | ( | ) | [protected] |
Update the cached information about the current style sheet.
Definition at line 1026 of file qwt_plot_canvas.cpp.
PrivateData* QwtPlotCanvas::d_data [private] |
Definition at line 165 of file qwt_plot_canvas.h.
double QwtPlotCanvas::borderRadius [read, write] |
Definition at line 31 of file qwt_plot_canvas.h.