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

针对QwtFigure的操作蒙版 更多...

#include <qwt_figure_widget_overlay.h>

类 QwtFigureWidgetOverlay 继承关系图:
QwtWidgetOverlay

class  PrivateData
 

Public 类型

enum  ControlType {
  ControlLineTop , ControlLineBottom , ControlLineLeft , ControlLineRight ,
  ControlPointTopLeft , ControlPointTopRight , ControlPointBottomLeft , ControlPointBottomRight ,
  Inner , OutSide
}
 用于标记矩形的区域 更多...
 
enum  BuiltInFunctionsFlag { FunSelectCurrentPlot = 1 , FunResizePlot = 2 }
 内置的功能标志 更多...
 
- Public 类型 继承自 QwtWidgetOverlay
enum  MaskMode { NoMask , MaskHint , AlphaMask }
 掩码模式 更多...
 
enum  RenderMode { AutoRenderMode , CopyAlphaMask , DrawOverlay }
 

Public 槽

void setActiveWidget (QWidget *w)
 Changes the active widget
 
- Public 槽 继承自 QwtWidgetOverlay
void updateOverlay ()
 重新计算掩码并重绘覆盖层
 

信号

void widgetNormGeometryChanged (QWidget *w, const QRectF &oldNormGeo, const QRectF &newNormGeo)
 绘图尺寸发生改变信号
 
void activeWidgetChanged (QWidget *oldActive, QWidget *newActive)
 激活窗口发生变化的信号
 
void finished (bool isCancel)
 操作完成信号
 

Public 成员函数

 QwtFigureWidgetOverlay (QwtFigure *fig)
 Constructor, passing nullptr is not allowed
 
QwtFigurefigure () const
 Returns the associated QwtFigure
 
void setTransparentForMouseEvents (bool on)
 设置是否对鼠标事件透明
 
bool isTransparentForMouseEvents () const
 判断是否对鼠标事件透明
 
void setBuiltInFunctionsEnable (BuiltInFunctionsFlag flag, bool on=true)
 Enables or disables built-in functions
 
bool testBuiltInFunctions (BuiltInFunctionsFlag flag) const
 Tests if a built-in function is enabled
 
bool hasActiveWidget () const
 Checks if there is an active widget
 
bool isResizing () const
 Checks if currently resizing
 
void setBorderPen (const QPen &p)
 Sets the border pen
 
QPen borderPen () const
 Returns the border pen
 
void setControlPointBrush (const QBrush &b)
 Sets the control point brush
 
QBrush controlPointBrush () const
 Returns the control point brush
 
void setControlPointSize (const QSize &c)
 Sets the control point size
 
QSize controlPointSize () const
 Returns the control point size (default 8x8)
 
void selectNextWidget (bool forward=true)
 Selects the next widget as the active widget
 
void selectNextPlot (bool forward=true)
 Selects the next plot as the active widget
 
QWidget * currentActiveWidget () const
 Returns the current active widget
 
QwtPlotcurrentActivePlot () const
 Returns the current active plot
 
void showPercentText (bool on=true)
 Shows or hides percentage text
 
virtual bool cancel ()
 Cancels the operation, emits finished(false) signal. Override should call this explicitly
 
- Public 成员函数 继承自 QwtWidgetOverlay
 QwtWidgetOverlay (QWidget *)
 构造函数
 
virtual ~QwtWidgetOverlay ()
 析构函数
 
void setMaskMode (MaskMode)
 指定如何为覆盖层查找掩码
 
MaskMode maskMode () const
 
void setRenderMode (RenderMode)
 设置渲染模式
 
RenderMode renderMode () const
 
virtual bool eventFilter (QObject *, QEvent *) override
 事件过滤器
 

静态 Public 成员函数

static Qt::CursorShape controlTypeToCursor (ControlType rr)
 Returns the cursor shape based on control type
 
static ControlType getPositionControlType (const QPoint &pos, const QRect &region, int err=1)
 Determines control type based on point position relative to rectangle
 
static bool isPointInRectEdget (const QPoint &pos, const QRect &region, int err=1)
 Checks if a point is on the edge of a rectangle
 

Protected 成员函数

virtual void drawOverlay (QPainter *p) const override
 绘制控件覆盖层
 
virtual QRegion maskHint () const override
 Calculate an approximation for the mask
 
virtual void drawActiveWidget (QPainter *painter, QWidget *activeW) const
 Draws the active widget
 
virtual void drawResizeingControlLine (QPainter *painter, const QRectF &willSetNormRect) const
 Draws the resizing rubber-band control line
 
virtual void drawControlLine (QPainter *painter, const QRect &actualRect, const QRectF &normRect) const
 Draws the control line
 
void startResize (ControlType controlType, const QPoint &pos)
 Helper function to mark the start of resizing
 
void mouseMoveEvent (QMouseEvent *me) override
 
void mouseReleaseEvent (QMouseEvent *me) override
 
void mousePressEvent (QMouseEvent *me) override
 
void keyPressEvent (QKeyEvent *ke) override
 
- Protected 成员函数 继承自 QwtWidgetOverlay
virtual void paintEvent (QPaintEvent *) override
 绘制事件
 
virtual void resizeEvent (QResizeEvent *) override
 调整大小事件
 

详细描述

针对QwtFigure的操作蒙版

成员枚举类型说明

◆ BuiltInFunctionsFlag

内置的功能标志

枚举值
FunSelectCurrentPlot 

Enable changing the currently selected plot

FunResizePlot 

Enable resizing plots

◆ ControlType

用于标记矩形的区域

构造及析构函数说明

◆ QwtFigureWidgetOverlay()

QwtFigureWidgetOverlay::QwtFigureWidgetOverlay ( QwtFigure fig)
explicit

Constructor, passing nullptr is not allowed

构造函数

成员函数说明

◆ activeWidgetChanged

void QwtFigureWidgetOverlay::activeWidgetChanged ( QWidget *  oldActive,
QWidget *  newActive 
)
signal

激活窗口发生变化的信号

◆ borderPen()

QPen QwtFigureWidgetOverlay::borderPen ( ) const

Returns the border pen

返回边框的画笔

◆ cancel()

bool QwtFigureWidgetOverlay::cancel ( )
virtual

Cancels the operation, emits finished(false) signal. Override should call this explicitly

取消操作

◆ controlPointBrush()

QBrush QwtFigureWidgetOverlay::controlPointBrush ( ) const

Returns the control point brush

返回控制点的填充画刷

◆ controlPointSize()

QSize QwtFigureWidgetOverlay::controlPointSize ( ) const

Returns the control point size (default 8x8)

返回控制点尺寸

◆ controlTypeToCursor()

Qt::CursorShape QwtFigureWidgetOverlay::controlTypeToCursor ( QwtFigureWidgetOverlay::ControlType  rr)
static

Returns the cursor shape based on control type

根据范围获取鼠标图标

参数
rr
返回
鼠标图标

◆ currentActivePlot()

QwtPlot * QwtFigureWidgetOverlay::currentActivePlot ( ) const

Returns the current active plot

获取当前激活的绘图

◆ currentActiveWidget()

QWidget * QwtFigureWidgetOverlay::currentActiveWidget ( ) const

Returns the current active widget

获取当前激活的窗体

◆ drawActiveWidget()

void QwtFigureWidgetOverlay::drawActiveWidget ( QPainter *  painter,
QWidget *  activeW 
) const
protectedvirtual

Draws the active widget

绘制激活的窗口

通过继承此函数可改变绘制的方式,默认绘制会调用drawControlLine 函数

参数
painter
activeW

◆ drawControlLine()

void QwtFigureWidgetOverlay::drawControlLine ( QPainter *  painter,
const QRect &  actualRect,
const QRectF &  normRect 
) const
protectedvirtual

Draws the control line

绘制控制线

参数
painter
actualRect真实尺寸
normRect归一化尺寸

◆ drawOverlay()

void QwtFigureWidgetOverlay::drawOverlay ( QPainter *  painter) const
overrideprotectedvirtual

绘制控件覆盖层

参数
painter绘制器

实现了 QwtWidgetOverlay.

◆ drawResizeingControlLine()

void QwtFigureWidgetOverlay::drawResizeingControlLine ( QPainter *  painter,
const QRectF &  willSetNormRect 
) const
protectedvirtual

Draws the resizing rubber-band control line

绘制resize变换的橡皮筋控制线

通过继承此函数可改变绘制的方式,默认绘制会调用drawControlLine 函数

参数
painter
willSetNormRect

◆ figure()

QwtFigure * QwtFigureWidgetOverlay::figure ( ) const

Returns the associated QwtFigure

返回关联的QwtFigure

◆ finished

void QwtFigureWidgetOverlay::finished ( bool  isCancel)
signal

操作完成信号

◆ getPositionControlType()

QwtFigureWidgetOverlay::ControlType QwtFigureWidgetOverlay::getPositionControlType ( const QPoint &  pos,
const QRect &  region,
int  err = 1 
)
static

Determines control type based on point position relative to rectangle

根据点和矩形的关系返回控制类型

◆ hasActiveWidget()

bool QwtFigureWidgetOverlay::hasActiveWidget ( ) const

Checks if there is an active widget

判断当前是否有激活的窗口

◆ isPointInRectEdget()

bool QwtFigureWidgetOverlay::isPointInRectEdget ( const QPoint &  pos,
const QRect &  region,
int  err = 1 
)
static

Checks if a point is on the edge of a rectangle

判断点是否在矩形区域的边缘

◆ isResizing()

bool QwtFigureWidgetOverlay::isResizing ( ) const

Checks if currently resizing

判断是否正在改变尺寸

◆ isTransparentForMouseEvents()

bool QwtFigureWidgetOverlay::isTransparentForMouseEvents ( ) const

判断是否对鼠标事件透明

◆ maskHint()

QRegion QwtFigureWidgetOverlay::maskHint ( ) const
overrideprotectedvirtual

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

重载 QwtWidgetOverlay .

◆ mouseReleaseEvent()

void QwtFigureWidgetOverlay::mouseReleaseEvent ( QMouseEvent *  me)
overrideprotected

由于在startResize时捕获了鼠标,因此,这里必须释放鼠标

◆ selectNextPlot()

void QwtFigureWidgetOverlay::selectNextPlot ( bool  forward = true)

Selects the next plot as the active widget

选择下一个绘图作为激活窗体

◆ selectNextWidget()

void QwtFigureWidgetOverlay::selectNextWidget ( bool  forward = true)

Selects the next widget as the active widget

选择下一个窗口作为激活窗体

◆ setActiveWidget

void QwtFigureWidgetOverlay::setActiveWidget ( QWidget *  w)
slot

Changes the active widget

设置当前激活的窗口

◆ setBorderPen()

void QwtFigureWidgetOverlay::setBorderPen ( const QPen &  p)

Sets the border pen

设置边框的画笔

◆ setBuiltInFunctionsEnable()

void QwtFigureWidgetOverlay::setBuiltInFunctionsEnable ( BuiltInFunctionsFlag  flag,
bool  on = true 
)

Enables or disables built-in functions

设置内置功能的开关

◆ setControlPointBrush()

void QwtFigureWidgetOverlay::setControlPointBrush ( const QBrush &  b)

Sets the control point brush

设置控制点的填充画刷

◆ setControlPointSize()

void QwtFigureWidgetOverlay::setControlPointSize ( const QSize &  c)

Sets the control point size

设置控制点尺寸

◆ setTransparentForMouseEvents()

void QwtFigureWidgetOverlay::setTransparentForMouseEvents ( bool  on)

设置是否对鼠标事件透明

◆ showPercentText()

void QwtFigureWidgetOverlay::showPercentText ( bool  on = true)

Shows or hides percentage text

显示或隐藏占比数值

◆ startResize()

void QwtFigureWidgetOverlay::startResize ( QwtFigureWidgetOverlay::ControlType  controlType,
const QPoint &  pos 
)
protected

Helper function to mark the start of resizing

开始变换的辅助函数,此函数会记录开始变换的状态

参数
controlType
pos

捕获鼠标,确保所有鼠标事件都发送到这个窗口 这个函数是关键,避免鼠标移动的时候被别的窗口捕获掉鼠标,导致无法接收到release事件 grabMouse可以:

  • 强制所有鼠标事件(移动、点击、释放等)都发送到调用该函数的窗口部件
  • 忽略鼠标的实际位置,即使鼠标移到了其他窗口或屏幕边缘
  • 确保鼠标事件链的完整性 此函数一定要releaseMouse,(releaseMouse在mouseReleaseEvent执行)

如果没有这个函数,鼠标移动到了底层绘图窗口或其他子窗口上,鼠标事件可能被这些窗口截获 QwtFigureWidgetOverlay收不到 mouseReleaseEvent,导致状态卡在"调整中"

◆ testBuiltInFunctions()

bool QwtFigureWidgetOverlay::testBuiltInFunctions ( BuiltInFunctionsFlag  flag) const

Tests if a built-in function is enabled

判断当前的功能开关状态

◆ widgetNormGeometryChanged

void QwtFigureWidgetOverlay::widgetNormGeometryChanged ( QWidget *  w,
const QRectF &  oldNormGeo,
const QRectF &  newNormGeo 
)
signal

绘图尺寸发生改变信号


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