Qwt User's Guide
svn
|
#include <qwt_plot_canvas.h>
Public Types | |
enum | FocusIndicator { NoFocusIndicator, CanvasFocusIndicator, ItemFocusIndicator } |
enum | PaintAttribute { BackingStore = 1, Opaque = 2, HackStyledBackground = 4, ImmediatePaint = 8 } |
typedef QFlags< PaintAttribute > | PaintAttributes |
Public Member Functions | |
const QPixmap * | backingStore () const |
QBitmap | borderMask (const QSize &) const |
QPainterPath | borderPath (const QRect &rect) const |
double | borderRadius () const |
virtual bool | event (QEvent *) |
FocusIndicator | focusIndicator () const |
void | invalidateBackingStore () |
QwtPlot * | plot () |
const QwtPlot * | plot () const |
QwtPlotCanvas (QwtPlot *) | |
void | replot () |
void | setBorderRadius (double) |
void | setFocusIndicator (FocusIndicator) |
void | setPaintAttribute (PaintAttribute, bool on=true) |
bool | testPaintAttribute (PaintAttribute) const |
virtual | ~QwtPlotCanvas () |
Protected Member Functions | |
virtual void | drawBorder (QPainter *) |
virtual void | drawFocusIndicator (QPainter *) |
virtual void | paintEvent (QPaintEvent *) |
virtual void | resizeEvent (QResizeEvent *) |
void | updateStyleSheetInfo () |
typedef QFlags<PaintAttribute> QwtPlotCanvas::PaintAttributes |
Paint attributes.
Focus indicator.
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 workin with widget overlays ( like rubberbands ). 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 seperate the background from the background border by reverse engeneering to paint the background before and the border after the plot items. In this order the border gets prefectly antialiased and you can avoid some pixel artifacts in the corners. |
ImmediatePaint |
When ImmediatePaint is set replot() calls repaint() instead of update().
|
QwtPlotCanvas::QwtPlotCanvas | ( | QwtPlot * | plot | ) | [explicit] |
Sets a cross cursor, enables QwtPlotCanvas::BackingStore.
QwtPlotCanvas::~QwtPlotCanvas | ( | ) | [virtual] |
Destructor.
const QPixmap * QwtPlotCanvas::backingStore | ( | ) | const |
QBitmap QwtPlotCanvas::borderMask | ( | const QSize & | size | ) | const |
Calculate a mask, that can be used to clip away the border frame
size | Size including the frame |
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 |
double QwtPlotCanvas::borderRadius | ( | ) | const |
void QwtPlotCanvas::drawBorder | ( | QPainter * | painter | ) | [protected, virtual] |
Draw the border of the plot canvas
painter | Painter |
void QwtPlotCanvas::drawFocusIndicator | ( | QPainter * | painter | ) | [protected, virtual] |
Draw the focus indication
painter | Painter |
bool QwtPlotCanvas::event | ( | QEvent * | event | ) | [virtual] |
Qt event handler for QEvent::PolishRequest and QEvent::StyleChange
event | Qt Event |
QwtPlotCanvas::FocusIndicator QwtPlotCanvas::focusIndicator | ( | ) | const |
void QwtPlotCanvas::invalidateBackingStore | ( | ) |
Invalidate the internal backing store.
void QwtPlotCanvas::paintEvent | ( | QPaintEvent * | event | ) | [protected, virtual] |
Paint event
event | Paint event |
QwtPlot * QwtPlotCanvas::plot | ( | ) |
Return parent plot widget.
const QwtPlot * QwtPlotCanvas::plot | ( | ) | const |
Return parent plot widget.
void QwtPlotCanvas::replot | ( | ) |
Invalidate the paint cache and repaint the canvas
void QwtPlotCanvas::resizeEvent | ( | QResizeEvent * | event | ) | [protected, virtual] |
Resize event
event | Resize event |
void QwtPlotCanvas::setBorderRadius | ( | double | radius | ) |
Set the radius for the corners of the border frame
radius | Radius of a rounded corner |
void QwtPlotCanvas::setFocusIndicator | ( | FocusIndicator | focusIndicator | ) |
Set the focus indicator
void QwtPlotCanvas::setPaintAttribute | ( | PaintAttribute | attribute, |
bool | on = true |
||
) |
Changing the paint attributes.
attribute | Paint attribute |
on | On/Off |
bool QwtPlotCanvas::testPaintAttribute | ( | PaintAttribute | attribute | ) | const |
Test wether a paint attribute is enabled
attribute | Paint attribute |
void QwtPlotCanvas::updateStyleSheetInfo | ( | ) | [protected] |
Update the cached informations about the current style sheet.