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

An overlay for a widget 更多...

#include <qwt_widget_overlay.h>

类 QwtWidgetOverlay 继承关系图:
QwtFigureWidgetOverlay

class  PrivateData
 

Public 类型

enum  MaskMode { NoMask , MaskHint , AlphaMask }
 Mask mode 更多...
 
enum  RenderMode { AutoRenderMode , CopyAlphaMask , DrawOverlay }
 Render mode 更多...
 

Public 槽

void updateOverlay ()
 Recalculate the mask and repaint the overlay
 

Public 成员函数

 QwtWidgetOverlay (QWidget *)
 Constructor
 
void setMaskMode (MaskMode)
 Specify how to find the mask for the overlay
 
MaskMode maskMode () const
 
void setRenderMode (RenderMode)
 Set the render mode
 
RenderMode renderMode () const
 
virtual bool eventFilter (QObject *, QEvent *) override
 Event filter
 

Protected 成员函数

virtual void paintEvent (QPaintEvent *) override
 Paint event
 
virtual void resizeEvent (QResizeEvent *) override
 Resize event
 
virtual QRegion maskHint () const
 Calculate an approximation for the mask
 
virtual void drawOverlay (QPainter *painter) const =0
 Draw the widget overlay
 

详细描述

An overlay for a widget

The main use case of an widget overlay is to avoid heavy repaint operation of the widget below.

F.e. in combination with the plot canvas an overlay avoid replots as the content of the canvas can be restored from its backing store.

QwtWidgetOverlay is an abstract base class. Deriving classes are supposed to reimplement the following methods:

Internally QwtPlotPicker uses overlays for displaying the rubber band and the tracker text.

参见
QwtPlotCanvas::BackingStore

成员枚举类型说明

◆ MaskMode

Mask mode

When using masks the widget below gets paint events for the masked regions of the overlay only. Otherwise Qt triggers full repaints. On less powerful hardware ( f.e embedded systems ) - or when using the raster paint engine on a remote desktop - bit blitting is a noticeable operation, that needs to be avoided.

If and how to mask depends on how expensive the calculation of the mask is and how many pixels can be excluded by the mask.

The default setting is MaskHint.

参见
setMaskMode(), maskMode()
枚举值
NoMask 

Don't use a mask.

MaskHint 

Use maskHint() as mask

For many situations a fast approximation is good enough and it is not necessary to build a more detailed mask ( f.e the bounding rectangle of a text ).

AlphaMask 

Calculate a mask by checking the alpha values

Sometimes it is not possible to give a fast approximation and the mask needs to be calculated by drawing the overlay and testing the result.

When a valid maskHint() is available only pixels inside this approximation are checked.

◆ RenderMode

Render mode

For calculating the alpha mask the overlay has already been painted to a temporary QImage. Instead of rendering the overlay twice this buffer can be copied for drawing the overlay.

On graphic systems using the raster paint engine ( QWS, Windows ) it means usually copying some memory only. On X11 it results in an expensive operation building a pixmap and for simple overlays it might not be recommended.

注解
The render mode has no effect, when maskMode() != AlphaMask.
枚举值
AutoRenderMode 

Copy the buffer, when using the raster paint engine.

CopyAlphaMask 

Always copy the buffer

DrawOverlay 

Never copy the buffer

构造及析构函数说明

◆ QwtWidgetOverlay()

QwtWidgetOverlay::QwtWidgetOverlay ( QWidget *  widget)
explicit

Constructor

参数
widgetParent widget, where the overlay is aligned to

Destructor

成员函数说明

◆ drawOverlay()

virtual void QwtWidgetOverlay::drawOverlay ( QPainter *  painter) const
protectedpure virtual

Draw the widget overlay

参数
painterPainter

QwtFigureWidgetOverlay 内被实现.

◆ eventFilter()

bool QwtWidgetOverlay::eventFilter ( QObject *  object,
QEvent *  event 
)
overridevirtual

Event filter

Resize the overlay according to the size of the parent widget.

参数
[in]objectObject to be filtered
[in]eventEvent
返回
See QObject::eventFilter()

◆ maskHint()

QRegion QwtWidgetOverlay::maskHint ( ) const
protectedvirtual

Calculate an approximation for the mask

  • MaskHint The hint is used as mask.
  • AlphaMask The hint is used to speed up the algorithm for calculating a mask from non transparent pixels
  • NoMask The hint is unused.

The default implementation returns an invalid region indicating no hint.

返回
Hint for the mask

QwtFigureWidgetOverlay 重载.

◆ maskMode()

QwtWidgetOverlay::MaskMode QwtWidgetOverlay::maskMode ( ) const
返回
Mode how to find the mask for the overlay
参见
setMaskMode()

◆ paintEvent()

void QwtWidgetOverlay::paintEvent ( QPaintEvent *  event)
overrideprotectedvirtual

Paint event

参数
eventPaint event
参见
drawOverlay()

◆ renderMode()

QwtWidgetOverlay::RenderMode QwtWidgetOverlay::renderMode ( ) const
返回
Render mode
参见
RenderMode, setRenderMode()

◆ resizeEvent()

void QwtWidgetOverlay::resizeEvent ( QResizeEvent *  event)
overrideprotectedvirtual

Resize event

参数
eventResize event

◆ setMaskMode()

void QwtWidgetOverlay::setMaskMode ( MaskMode  mode)

Specify how to find the mask for the overlay

参数
modeNew mode
参见
maskMode()

◆ setRenderMode()

void QwtWidgetOverlay::setRenderMode ( RenderMode  mode)

Set the render mode

参数
[in]modeRender mode
参见
RenderMode, renderMode()

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