QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
| Public 类型 | Public 槽 | Public 成员函数 | Protected 成员函数 | 属性 | 所有成员列表
QwtPlotCanvas类 参考

Canvas of a QwtPlot 更多...

#include <qwt_plot_canvas.h>

类 QwtPlotCanvas 继承关系图:
QwtPlotAbstractCanvas

class  PrivateData
 

Public 类型

enum  PaintAttribute { BackingStore = 1 , Opaque = 2 , HackStyledBackground = 4 , ImmediatePaint = 8 }
 Paint attributes 更多...
 
- Public 类型 继承自 QwtPlotAbstractCanvas
enum  FocusIndicator { NoFocusIndicator , CanvasFocusIndicator , ItemFocusIndicator }
 Focus indicator 更多...
 

Public 槽

void replot ()
 Invalidate the paint cache and repaint the canvas
 

Public 成员函数

 QwtPlotCanvas (QwtPlot *=nullptr)
 Constructor
 
void setPaintAttribute (PaintAttribute, bool on=true)
 Change the paint attributes
 
bool testPaintAttribute (PaintAttribute) const
 Test whether a paint attribute is enabled
 
const QPixmap * backingStore () const
 Get the backing store
 
Q_INVOKABLE void invalidateBackingStore ()
 Invalidate the internal backing store
 
virtual bool event (QEvent *) 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 成员函数 继承自 QwtPlotAbstractCanvas
 QwtPlotAbstractCanvas (QWidget *canvasWidget)
 Constructor
 
QwtPlotplot ()
 Return parent plot widget
 
const QwtPlotplot () const
 Return parent plot widget
 
void setFocusIndicator (FocusIndicator)
 Set the focus indicator
 
FocusIndicator focusIndicator () const
 Get the focus indicator
 
void setBorderRadius (double)
 Set the radius for the corners of the border frame
 
double borderRadius () const
 Get the radius for the corners of the border frame
 

Protected 成员函数

virtual void paintEvent (QPaintEvent *) override
 Paint event handler
 
virtual void resizeEvent (QResizeEvent *) override
 Resize event handler
 
virtual void drawBorder (QPainter *) override
 Draw border
 
- Protected 成员函数 继承自 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
 

属性

double borderRadius
 

详细描述

Canvas of a QwtPlot

Canvas is the widget where all plot items are displayed

参见
QwtPlot::setCanvas(), QwtPlotGLCanvas, QwtPlotOpenGLCanvas

成员枚举类型说明

◆ PaintAttribute

Paint attributes

The default setting enables BackingStore and Opaque.

参见
setPaintAttribute(), testPaintAttribute()
枚举值
BackingStore 

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).

参见
backingStore(), invalidateBackingStore()
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. When the Opaque attribute is enabled the canvas tries to identify the gaps with some heuristics and to fill those only.

警告
Will not work for semitransparent backgrounds.
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. 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 

ImmediatePaint

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

参见
replot(), QWidget::repaint(), QWidget::update()

构造及析构函数说明

◆ QwtPlotCanvas()

QwtPlotCanvas::QwtPlotCanvas ( QwtPlot plot = nullptr)
explicit

Constructor

参数
[in]plotParent plot widget
参见
QwtPlot::setCanvas()

Destructor

成员函数说明

◆ backingStore()

const QPixmap * QwtPlotCanvas::backingStore ( ) const

Get the backing store

返回
Backing store pixmap, might be null

◆ borderPath()

QPainterPath QwtPlotCanvas::borderPath ( const QRect &  rect) const

Calculate the painter path for a styled or rounded border

参数
[in]rectBounding rectangle of the canvas
返回
Painter path that can be used for clipping

When the canvas has no styled background or rounded borders, the painter path is empty.

◆ drawBorder()

void QwtPlotCanvas::drawBorder ( QPainter *  painter)
overrideprotectedvirtual

Draw border

Draw the border of the plot canvas

参数
painterPainter
参见
setBorderRadius()

重载 QwtPlotAbstractCanvas .

◆ event()

bool QwtPlotCanvas::event ( QEvent *  event)
overridevirtual

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

参数
[in]eventQt Event
返回
See QFrame::event()

◆ paintEvent()

void QwtPlotCanvas::paintEvent ( QPaintEvent *  event)
overrideprotectedvirtual

Paint event handler

Paint event

参数
eventPaint event

◆ replot

void QwtPlotCanvas::replot ( )
slot

Invalidate the paint cache and repaint the canvas

参见
invalidatePaintCache()

◆ resizeEvent()

void QwtPlotCanvas::resizeEvent ( QResizeEvent *  event)
overrideprotectedvirtual

Resize event handler

Resize event

参数
eventResize event

◆ setPaintAttribute()

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

Change the paint attributes

参数
[in]attributePaint attribute
[in]onOn/Off
参见
testPaintAttribute(), backingStore()

◆ testPaintAttribute()

bool QwtPlotCanvas::testPaintAttribute ( PaintAttribute  attribute) const

Test whether a paint attribute is enabled

参数
[in]attributePaint attribute
返回
true when attribute is enabled
参见
setPaintAttribute()

该类的文档由以下文件生成: