|
QWT API (中文) 7.0.1
Qt绘图库 - 中文API文档
|
针对QwtFigure的操作蒙版 更多...
#include <qwt_figure_widget_overlay.h>
类 | |
| 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 | |
| QwtFigure * | figure () 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 | |
| QwtPlot * | currentActivePlot () 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 ®ion, int err=1) |
| Determines control type based on point position relative to rectangle | |
| static bool | isPointInRectEdget (const QPoint &pos, const QRect ®ion, 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的操作蒙版
用于标记矩形的区域
|
explicit |
Constructor, passing nullptr is not allowed
构造函数
|
signal |
激活窗口发生变化的信号
| QPen QwtFigureWidgetOverlay::borderPen | ( | ) | const |
Returns the border pen
返回边框的画笔
|
virtual |
Cancels the operation, emits finished(false) signal. Override should call this explicitly
取消操作
| QBrush QwtFigureWidgetOverlay::controlPointBrush | ( | ) | const |
Returns the control point brush
返回控制点的填充画刷
| QSize QwtFigureWidgetOverlay::controlPointSize | ( | ) | const |
Returns the control point size (default 8x8)
返回控制点尺寸
|
static |
Returns the cursor shape based on control type
根据范围获取鼠标图标
| rr |
| QwtPlot * QwtFigureWidgetOverlay::currentActivePlot | ( | ) | const |
Returns the current active plot
获取当前激活的绘图
| QWidget * QwtFigureWidgetOverlay::currentActiveWidget | ( | ) | const |
Returns the current active widget
获取当前激活的窗体
|
protectedvirtual |
|
protectedvirtual |
Draws the control line
绘制控制线
| painter | |
| actualRect | 真实尺寸 |
| normRect | 归一化尺寸 |
|
overrideprotectedvirtual |
|
protectedvirtual |
Draws the resizing rubber-band control line
绘制resize变换的橡皮筋控制线
通过继承此函数可改变绘制的方式,默认绘制会调用drawControlLine 函数
| painter | |
| willSetNormRect |
| QwtFigure * QwtFigureWidgetOverlay::figure | ( | ) | const |
Returns the associated QwtFigure
返回关联的QwtFigure
|
signal |
操作完成信号
|
static |
Determines control type based on point position relative to rectangle
根据点和矩形的关系返回控制类型
| bool QwtFigureWidgetOverlay::hasActiveWidget | ( | ) | const |
Checks if there is an active widget
判断当前是否有激活的窗口
|
static |
Checks if a point is on the edge of a rectangle
判断点是否在矩形区域的边缘
| bool QwtFigureWidgetOverlay::isResizing | ( | ) | const |
Checks if currently resizing
判断是否正在改变尺寸
| bool QwtFigureWidgetOverlay::isTransparentForMouseEvents | ( | ) | const |
判断是否对鼠标事件透明
|
overrideprotectedvirtual |
Calculate an approximation for the mask
The default implementation returns an invalid region indicating no hint.
重载 QwtWidgetOverlay .
|
overrideprotected |
由于在startResize时捕获了鼠标,因此,这里必须释放鼠标
| void QwtFigureWidgetOverlay::selectNextPlot | ( | bool | forward = true | ) |
Selects the next plot as the active widget
选择下一个绘图作为激活窗体
| void QwtFigureWidgetOverlay::selectNextWidget | ( | bool | forward = true | ) |
Selects the next widget as the active widget
选择下一个窗口作为激活窗体
|
slot |
Changes the active widget
设置当前激活的窗口
| void QwtFigureWidgetOverlay::setBorderPen | ( | const QPen & | p | ) |
Sets the border pen
设置边框的画笔
| void QwtFigureWidgetOverlay::setBuiltInFunctionsEnable | ( | BuiltInFunctionsFlag | flag, |
| bool | on = true |
||
| ) |
Enables or disables built-in functions
设置内置功能的开关
| void QwtFigureWidgetOverlay::setControlPointBrush | ( | const QBrush & | b | ) |
Sets the control point brush
设置控制点的填充画刷
| void QwtFigureWidgetOverlay::setControlPointSize | ( | const QSize & | c | ) |
Sets the control point size
设置控制点尺寸
| void QwtFigureWidgetOverlay::setTransparentForMouseEvents | ( | bool | on | ) |
设置是否对鼠标事件透明
| void QwtFigureWidgetOverlay::showPercentText | ( | bool | on = true | ) |
Shows or hides percentage text
显示或隐藏占比数值
|
protected |
Helper function to mark the start of resizing
开始变换的辅助函数,此函数会记录开始变换的状态
| controlType | |
| pos |
捕获鼠标,确保所有鼠标事件都发送到这个窗口 这个函数是关键,避免鼠标移动的时候被别的窗口捕获掉鼠标,导致无法接收到release事件 grabMouse可以:
如果没有这个函数,鼠标移动到了底层绘图窗口或其他子窗口上,鼠标事件可能被这些窗口截获 QwtFigureWidgetOverlay收不到 mouseReleaseEvent,导致状态卡在"调整中"
| bool QwtFigureWidgetOverlay::testBuiltInFunctions | ( | BuiltInFunctionsFlag | flag | ) | const |
Tests if a built-in function is enabled
判断当前的功能开关状态
|
signal |
绘图尺寸发生改变信号