An overlay widget for QwtFigure that provides interactive manipulation.
More...
#include <qwt_figure_widget_overlay.h>
|
| enum | ControlType {
ControlLineTop
, ControlLineBottom
, ControlLineLeft
, ControlLineRight
,
ControlPointTopLeft
, ControlPointTopRight
, ControlPointBottomLeft
, ControlPointBottomRight
,
Inner
, OutSide
} |
| | Enum for marking rectangular control regions . More...
|
| |
| enum | BuiltInFunctionsFlag { FunSelectCurrentPlot = 1
, FunResizePlot = 2
} |
| | Built-in functionality flags . More...
|
| |
| enum | MaskMode { NoMask
, MaskHint
, AlphaMask
} |
| | Mask mode. More...
|
| |
| enum | RenderMode { AutoRenderMode
, CopyAlphaMask
, DrawOverlay
} |
| |
|
| void | widgetNormGeometryChanged (QWidget *w, const QRectF &oldNormGeo, const QRectF &newNormGeo) |
| | Signal emitted when widget normalized geometry changes.
|
| |
| void | activeWidgetChanged (QWidget *oldActive, QWidget *newActive) |
| | Signal emitted when the active widget changes.
|
| |
| void | finished (bool isCancel) |
| | Signal emitted when the operation finishes.
|
| |
|
| 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 |
| | 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 |
| |
| virtual void | paintEvent (QPaintEvent *) override |
| | Paint event
|
| |
| virtual void | resizeEvent (QResizeEvent *) override |
| | Resize event
|
| |
An overlay widget for QwtFigure that provides interactive manipulation.
◆ BuiltInFunctionsFlag
Built-in functionality flags .
| Enumerator |
|---|
| FunSelectCurrentPlot | Enable changing the currently selected plot.
|
| FunResizePlot | Enable resizing plots.
|
◆ ControlType
Enum for marking rectangular control regions .
◆ QwtFigureWidgetOverlay()
| QwtFigureWidgetOverlay::QwtFigureWidgetOverlay |
( |
QwtFigure * |
fig | ) |
|
|
explicit |
Constructor, passing nullptr is not allowed.
Constructor.
◆ activeWidgetChanged
| void QwtFigureWidgetOverlay::activeWidgetChanged |
( |
QWidget * |
oldActive, |
|
|
QWidget * |
newActive |
|
) |
| |
|
signal |
Signal emitted when the active widget changes.
◆ borderPen()
| QPen QwtFigureWidgetOverlay::borderPen |
( |
| ) |
const |
◆ cancel()
| bool QwtFigureWidgetOverlay::cancel |
( |
| ) |
|
|
virtual |
Cancels the operation, emits finished(false) signal. Override should call this explicitly.
Cancels the operation.
◆ controlPointBrush()
| QBrush QwtFigureWidgetOverlay::controlPointBrush |
( |
| ) |
const |
Returns the control point brush.
◆ controlPointSize()
| QSize QwtFigureWidgetOverlay::controlPointSize |
( |
| ) |
const |
Returns the control point size (default 8x8)
Returns the control point size.
◆ controlTypeToCursor()
Returns the cursor shape based on control type.
根据范围获取鼠标图标
- Parameters
-
- Returns
- 鼠标图标
◆ 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 函数
- Parameters
-
◆ drawControlLine()
| void QwtFigureWidgetOverlay::drawControlLine |
( |
QPainter * |
painter, |
|
|
const QRect & |
actualRect, |
|
|
const QRectF & |
normRect |
|
) |
| const |
|
protectedvirtual |
Draws the control line.
绘制控制线
- Parameters
-
| painter | |
| actualRect | 真实尺寸 |
| normRect | 归一化尺寸 |
◆ drawOverlay()
| void QwtFigureWidgetOverlay::drawOverlay |
( |
QPainter * |
painter | ) |
const |
|
overrideprotectedvirtual |
◆ drawResizeingControlLine()
| void QwtFigureWidgetOverlay::drawResizeingControlLine |
( |
QPainter * |
painter, |
|
|
const QRectF & |
willSetNormRect |
|
) |
| const |
|
protectedvirtual |
Draws the resizing rubber-band control line.
绘制resize变换的橡皮筋控制线
通过继承此函数可改变绘制的方式,默认绘制会调用drawControlLine 函数
- Parameters
-
◆ figure()
| QwtFigure * QwtFigureWidgetOverlay::figure |
( |
| ) |
const |
◆ finished
| void QwtFigureWidgetOverlay::finished |
( |
bool |
isCancel | ) |
|
|
signal |
Signal emitted when the operation finishes.
◆ getPositionControlType()
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 |
Checks if the overlay is transparent for mouse events.
◆ 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.
- Returns
- Hint for the mask
Reimplemented from 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.
Sets the current active widget.
◆ setBorderPen()
| void QwtFigureWidgetOverlay::setBorderPen |
( |
const QPen & |
p | ) |
|
◆ 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 | ) |
|
Sets whether the overlay is transparent for mouse events.
◆ showPercentText()
| void QwtFigureWidgetOverlay::showPercentText |
( |
bool |
on = true | ) |
|
Shows or hides percentage text.
◆ startResize()
Helper function to mark the start of resizing.
开始变换的辅助函数,此函数会记录开始变换的状态
- Parameters
-
捕获鼠标,确保所有鼠标事件都发送到这个窗口 这个函数是关键,避免鼠标移动的时候被别的窗口捕获掉鼠标,导致无法接收到release事件 grabMouse可以:
- 强制所有鼠标事件(移动、点击、释放等)都发送到调用该函数的窗口部件
- 忽略鼠标的实际位置,即使鼠标移到了其他窗口或屏幕边缘
- 确保鼠标事件链的完整性 此函数一定要releaseMouse,(releaseMouse在mouseReleaseEvent执行)
如果没有这个函数,鼠标移动到了底层绘图窗口或其他子窗口上,鼠标事件可能被这些窗口截获 QwtFigureWidgetOverlay收不到 mouseReleaseEvent,导致状态卡在"调整中"
◆ testBuiltInFunctions()
Tests if a built-in function is enabled.
◆ widgetNormGeometryChanged
| void QwtFigureWidgetOverlay::widgetNormGeometryChanged |
( |
QWidget * |
w, |
|
|
const QRectF & |
oldNormGeo, |
|
|
const QRectF & |
newNormGeo |
|
) |
| |
|
signal |
Signal emitted when widget normalized geometry changes.
The documentation for this class was generated from the following files: