|
QWT 7.0.1
|
#include <qwt_plot_canvas.h>
Classes | |
| class | PrivateData |
Public Types | |
| enum | PaintAttribute { BackingStore = 1 , Opaque = 2 , HackStyledBackground = 4 , ImmediatePaint = 8 } |
| Paint attributes/绘制属性 More... | |
Public Types inherited from QwtPlotAbstractCanvas | |
| enum | FocusIndicator { NoFocusIndicator , CanvasFocusIndicator , ItemFocusIndicator } |
| Focus indicator The default setting is NoFocusIndicator. More... | |
Public Slots | |
| void | replot () |
| Invalidate the paint cache and repaint the canvas. | |
Public Member Functions | |
| QwtPlotCanvas (QwtPlot *=NULL) | |
| Constructor. | |
| virtual | ~QwtPlotCanvas () |
| Destructor. | |
| void | setPaintAttribute (PaintAttribute, bool on=true) |
| Changing the paint attributes. | |
| bool | testPaintAttribute (PaintAttribute) const |
| Test whether a paint attribute is enabled. | |
| const QPixmap * | backingStore () const |
| Q_INVOKABLE void | invalidateBackingStore () |
| Invalidate the internal backing store. | |
| virtual bool | event (QEvent *) QWT_OVERRIDE |
| Qt event handler for QEvent::PolishRequest and QEvent::StyleChange. | |
| Q_INVOKABLE QPainterPath | borderPath (const QRect &) const |
| Calculate the painter path for a styled or rounded border. | |
Public Member Functions inherited from QwtPlotAbstractCanvas | |
| QwtPlotAbstractCanvas (QWidget *canvasWidget) | |
| Constructor. | |
| virtual | ~QwtPlotAbstractCanvas () |
| Destructor. | |
| QwtPlot * | plot () |
| Return parent plot widget. | |
| const QwtPlot * | plot () const |
| Return parent plot widget. | |
| void | setFocusIndicator (FocusIndicator) |
| Set the focus indicator. | |
| FocusIndicator | focusIndicator () const |
| void | setBorderRadius (double) |
| Set the radius for the corners of the border frame. | |
| double | borderRadius () const |
Protected Member Functions | |
| virtual void | paintEvent (QPaintEvent *) QWT_OVERRIDE |
| Paint event. | |
| virtual void | resizeEvent (QResizeEvent *) QWT_OVERRIDE |
| Resize event. | |
| virtual void | drawBorder (QPainter *) QWT_OVERRIDE |
| Draw the border of the plot canvas. | |
Protected Member Functions inherited from QwtPlotAbstractCanvas | |
| QWidget * | canvasWidget () |
| const QWidget * | canvasWidget () const |
| virtual void | drawFocusIndicator (QPainter *) |
| Draw the focus indication. | |
| virtual void | drawBackground (QPainter *) |
| Helper function for the derived plot canvas. | |
| void | fillBackground (QPainter *) |
| Helper function for the derived plot canvas. | |
| void | drawCanvas (QPainter *) |
| Draw the plot to the canvas. | |
| void | drawStyled (QPainter *, bool) |
| Helper function for the derived plot canvas. | |
| void | drawUnstyled (QPainter *) |
| Helper function for the derived plot canvas. | |
| QPainterPath | canvasBorderPath (const QRect &rect) const |
| void | updateStyleSheetInfo () |
| Update the cached information about the current style sheet. | |
Properties | |
| double | borderRadius |
Canvas of a QwtPlot.
Canvas is the widget where all plot items are displayed
Paint attributes/绘制属性
The default setting enables BackingStore and Opaque.
默认设置启用 BackingStore 与 Opaque
| Enumerator | |
|---|---|
| BackingStore | BackingStore. Paint double buffered reusing the content of the pixmap buffer when possible. 双缓冲绘制,尽可能复用 pixmap 缓存的内容。 Using a backing store might improve the performance significantly, when working with widget overlays (like rubber bands). 使用后备存储可显著提升性能,尤其当存在部件叠加(如 rubber band)时。 Disabling the cache might improve the performance for incremental paints (using QwtPlotDirectPainter). 禁用缓存可能提升增量绘制(如使用 QwtPlotDirectPainter)的性能。
|
| Opaque | 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 (e.g. 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. 使用样式背景时,Qt 假定画布并未完全填充其区域(例如圆角边框), 因而会在画布下方继续填充。若使用渐变填充,这可能成为严重性能瓶颈。 When the Opaque attribute is enabled the canvas tries to identify the gaps with some heuristics and to fill those only. 启用 Opaque 后,画布会通过启发式算法识别空隙并仅填充这些区域。
|
| HackStyledBackground | 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. QwtPlotCanvas 支持盒模型属性,以便通过样式表自定义布局。 遗憾的是,Qt 样式表的设计并未提供处理圆角背景的方案,除 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. 启用 HackStyledBackground 后,画布会通过逆向工程将背景与边框分离: 先绘制背景,再绘制边框,使边框获得完美抗锯齿并避免角落像素伪影。 |
| ImmediatePaint | ImmediatePaint. When ImmediatePaint is set replot() calls repaint() instead of update(). 当 ImmediatePaint 被设置时,replot() 将调用 repaint() 而非 update()。
|
|
explicit |
| const QPixmap * QwtPlotCanvas::backingStore | ( | ) | const |
| 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 |
|
protectedvirtual |
Draw the border of the plot canvas.
| painter | Painter |
Reimplemented from QwtPlotAbstractCanvas.
|
virtual |
Qt event handler for QEvent::PolishRequest and QEvent::StyleChange.
| event | Qt Event |
|
protectedvirtual |
Paint event.
| event | Paint event |
|
slot |
Invalidate the paint cache and repaint the canvas.
|
protectedvirtual |
Resize event.
| event | Resize event |
| 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 whether a paint attribute is enabled.
| attribute | Paint attribute |