|
QWT 7.0.1
|
The QwtFigureWidgetOverlay是针对QwtFigure的操作蒙版 More...
#include <qwt_figure_widget_overlay.h>
Classes | |
| class | PrivateData |
Public Types | |
| enum | ControlType { ControlLineTop , ControlLineBottom , ControlLineLeft , ControlLineRight , ControlPointTopLeft , ControlPointTopRight , ControlPointBottomLeft , ControlPointBottomRight , Inner , OutSide } |
| 用于标记矩形的区域 | |
| enum | BuiltInFunctionsFlag { FunSelectCurrentPlot = 1 , FunResizePlot = 2 } |
| 内置的功能 More... | |
Public Types inherited from QwtWidgetOverlay | |
| enum | MaskMode { NoMask , MaskHint , AlphaMask } |
| Mask mode. More... | |
| enum | RenderMode { AutoRenderMode , CopyAlphaMask , DrawOverlay } |
| Render mode. More... | |
Public Slots | |
| void | setActiveWidget (QWidget *w) |
| 设置当前激活的窗口 | |
Public Slots inherited from QwtWidgetOverlay | |
| void | updateOverlay () |
| Recalculate the mask and repaint the overlay. | |
Signals | |
| void | widgetNormGeometryChanged (QWidget *w, const QRectF &oldNormGeo, const QRectF &newNormGeo) |
| 绘图尺寸发生改变信号 | |
| void | activeWidgetChanged (QWidget *oldActive, QWidget *newActive) |
| 激活窗口发生变化的信号 | |
Public Member Functions | |
| QwtFigureWidgetOverlay (QwtFigure *fig) | |
| QwtFigureWidgetOverlay的构造函数 | |
| QwtFigure * | figure () const |
| void | setTransparentForMouseEvents (bool on) |
| void | setBuiltInFunctionsEnable (BuiltInFunctionsFlag flag, bool on=true) |
| 设置内置功能的开关 | |
| bool | testBuiltInFunctions (BuiltInFunctionsFlag flag) const |
| 判断当前的功能开关 | |
| bool | isHaveActiveWidget () const |
| 判断当前是否有激活的窗口 | |
| void | setBorderPen (const QPen &p) |
| 设置边框的画笔 | |
| QPen | borderPen () const |
| 边框的画笔 | |
| void | setControlPointBrush (const QBrush &b) |
| 设置控制点的填充 | |
| QBrush | controlPointBrush () const |
| 控制点的填充 | |
| void | setControlPointSize (const QSize &c) |
| 设置控制点尺寸 | |
| QSize | controlPointSize () const |
| 控制点尺寸 @default 8*8 | |
| void | selectNextWidget (bool forward=true) |
| 选择下一个窗口作为激活窗体 | |
| void | selectNextPlot (bool forward=true) |
| 选择下一个绘图作为激活窗体 | |
| QWidget * | currentActiveWidget () const |
| 获取当前激活的窗体 | |
| QwtPlot * | currentActivePlot () const |
| 获取当前激活的绘图 | |
| void | showPercentText (bool on=true) |
| 显示占比数值 | |
Public Member Functions inherited from QwtWidgetOverlay | |
| QwtWidgetOverlay (QWidget *) | |
| Constructor. | |
| virtual | ~QwtWidgetOverlay () |
| Destructor. | |
| 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 *) QWT_OVERRIDE |
| Event filter. | |
Static Public Member Functions | |
| static Qt::CursorShape | controlTypeToCursor (ControlType rr) |
| 根据范围获取鼠标图标 | |
| static ControlType | getPositionControlType (const QPoint &pos, const QRect ®ion, int err=1) |
| 根据点和矩形的关系,返回图标的样式 | |
| static bool | isPointInRectEdget (const QPoint &pos, const QRect ®ion, int err=1) |
| 判断点是否在矩形区域的边缘 | |
Protected Member Functions | |
| virtual void | drawOverlay (QPainter *p) const override |
| Draw the widget overlay. | |
| virtual QRegion | maskHint () const override |
| Calculate an approximation for the mask. | |
| virtual void | drawActiveWidget (QPainter *painter, QWidget *activeW) const |
| 绘制激活的窗口 | |
| virtual void | drawResizeingControlLine (QPainter *painter, const QRectF &willSetNormRect) const |
| 绘制resize变换的橡皮筋控制线 | |
| virtual void | drawControlLine (QPainter *painter, const QRect &actualRect, const QRectF &normRect) const |
| 绘制控制线 | |
| void | startResize (ControlType controlType, const QPoint &pos) |
| 开始变换的辅助函数,此函数会记录开始变换的状态 | |
| void | mouseMoveEvent (QMouseEvent *me) override |
| void | mouseReleaseEvent (QMouseEvent *me) override |
| void | mousePressEvent (QMouseEvent *me) override |
| void | keyPressEvent (QKeyEvent *ke) override |
Protected Member Functions inherited from QwtWidgetOverlay | |
| virtual void | paintEvent (QPaintEvent *) QWT_OVERRIDE |
| Paint event. | |
| virtual void | resizeEvent (QResizeEvent *) QWT_OVERRIDE |
| Resize event. | |
The QwtFigureWidgetOverlay是针对QwtFigure的操作蒙版
此类提供了figure窗口子对象调整大小的功能,以及改变当前绘图的功能,你可以通过继承此类实现耕地的操作
|
explicit |
QwtFigureWidgetOverlay的构造函数
| fig |
|
signal |
激活窗口发生变化的信号
| oldActive | 如果之前没有激活窗口,此指针有可能是nullptr |
| newActive | 如果没有新的激活窗口,此指针有可能是nullptr |
| QPen QwtFigureWidgetOverlay::borderPen | ( | ) | const |
边框的画笔
| p |
| QBrush QwtFigureWidgetOverlay::controlPointBrush | ( | ) | const |
控制点的填充
| b |
| QSize QwtFigureWidgetOverlay::controlPointSize | ( | ) | const |
控制点尺寸 @default 8*8
|
static |
根据范围获取鼠标图标
| rr |
| QwtPlot * QwtFigureWidgetOverlay::currentActivePlot | ( | ) | const |
获取当前激活的绘图
| QWidget * QwtFigureWidgetOverlay::currentActiveWidget | ( | ) | const |
获取当前激活的窗体
|
protectedvirtual |
|
protectedvirtual |
绘制控制线
| painter | |
| actualRect | 真实尺寸 |
| normRect | 归一化尺寸 |
|
overrideprotectedvirtual |
|
protectedvirtual |
|
static |
根据点和矩形的关系,返回图标的样式
| pos | 点 |
| region | 矩形区域 |
| err | 允许误差 |
| bool QwtFigureWidgetOverlay::isHaveActiveWidget | ( | ) | const |
判断当前是否有激活的窗口
|
static |
判断点是否在矩形区域的边缘
| pos | 点 |
| region | 矩形区域 |
| err | 允许误差 |
|
overrideprotectedvirtual |
Calculate an approximation for the mask.
The default implementation returns an invalid region indicating no hint.
Reimplemented from QwtWidgetOverlay.
|
overrideprotected |
由于在startResize时捕获了鼠标,因此,这里必须释放鼠标
| void QwtFigureWidgetOverlay::selectNextPlot | ( | bool | forward = true | ) |
选择下一个绘图作为激活窗体
| forward |
| void QwtFigureWidgetOverlay::selectNextWidget | ( | bool | forward = true | ) |
选择下一个窗口作为激活窗体
| forward |
|
slot |
设置当前激活的窗口
| w | 如果w和当前的activePlot一样,不做任何动作 |
| void QwtFigureWidgetOverlay::setBorderPen | ( | const QPen & | p | ) |
设置边框的画笔
| p |
| void QwtFigureWidgetOverlay::setBuiltInFunctionsEnable | ( | BuiltInFunctionsFlag | flag, |
| bool | on = true |
||
| ) |
| void QwtFigureWidgetOverlay::setControlPointBrush | ( | const QBrush & | b | ) |
设置控制点的填充
| b |
| void QwtFigureWidgetOverlay::setControlPointSize | ( | const QSize & | c | ) |
设置控制点尺寸
| c |
| void QwtFigureWidgetOverlay::showPercentText | ( | bool | on = true | ) |
显示占比数值
| on |
|
protected |
开始变换的辅助函数,此函数会记录开始变换的状态
| controlType | |
| pos |
捕获鼠标,确保所有鼠标事件都发送到这个窗口 这个函数是关键,避免鼠标移动的时候被别的窗口捕获掉鼠标,导致无法接收到release事件 grabMouse可以:
如果没有这个函数,鼠标移动到了底层绘图窗口或其他子窗口上,鼠标事件可能被这些窗口截获 QwtFigureWidgetOverlay收不到 mouseReleaseEvent,导致状态卡在"调整中"
| bool QwtFigureWidgetOverlay::testBuiltInFunctions | ( | BuiltInFunctionsFlag | flag | ) | const |
判断当前的功能开关
| flag |
|
signal |
绘图尺寸发生改变信号
| w | 窗口 |
| oldGeometry | 旧的位置 |
| newGeometry | 新的位置 |