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

An overlay widget for QwtFigure that provides interactive manipulation 更多...

#include <qwt_figure_widget_overlay.h>

类 QwtFigureWidgetOverlay 继承关系图:
QwtWidgetOverlay

class  PrivateData
 

Public 类型

enum  ControlType {
  ControlLineTop , ControlLineBottom , ControlLineLeft , ControlLineRight ,
  ControlPointTopLeft , ControlPointTopRight , ControlPointBottomLeft , ControlPointBottomRight ,
  Inner , OutSide
}
 Enum for marking rectangular control regions
 
enum  BuiltInFunctionsFlag { FunSelectCurrentPlot = 1 , FunResizePlot = 2 }
 Built-in functionality flags 更多...
 
- Public 类型 继承自 QwtWidgetOverlay
enum  MaskMode { NoMask , MaskHint , AlphaMask }
 Mask mode 更多...
 
enum  RenderMode { AutoRenderMode , CopyAlphaMask , DrawOverlay }
 Render mode 更多...
 

Public 槽

void setActiveWidget (QWidget *w)
 Changes the active widget
 
- Public 槽 继承自 QwtWidgetOverlay
void updateOverlay ()
 Recalculate the mask and repaint the overlay
 

信号

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
 

Public 成员函数

 QwtFigureWidgetOverlay (QwtFigure *fig)
 Constructor, passing nullptr is not allowed
 
QwtFigurefigure () const
 Returns the associated QwtFigure
 
void setTransparentForMouseEvents (bool on)
 Sets whether the overlay is transparent for mouse events
 
bool isTransparentForMouseEvents () const
 Checks if the overlay is transparent for mouse events
 
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 *)
 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
 

静态 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
 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
 
- Protected 成员函数 继承自 QwtWidgetOverlay
virtual void paintEvent (QPaintEvent *) override
 Paint event
 
virtual void resizeEvent (QResizeEvent *) override
 Resize event
 

详细描述

An overlay widget for QwtFigure that provides interactive manipulation

This class provides functionality for resizing child widgets within a figure window and changing the currently active plot. You can extend this class to implement additional operations.

注解
QwtFigureWidgetOverlay does not directly modify sizes. Size changes are performed in the managing window, allowing greater flexibility such as implementing undo/redo functionality.

成员枚举类型说明

◆ BuiltInFunctionsFlag

Built-in functionality flags

枚举值
FunSelectCurrentPlot 

Enable changing the currently selected plot

FunResizePlot 

Enable resizing plots

构造及析构函数说明

◆ QwtFigureWidgetOverlay()

QwtFigureWidgetOverlay::QwtFigureWidgetOverlay ( QwtFigure fig)
explicit

Constructor, passing nullptr is not allowed

Constructor

参数
[in]figThe QwtFigure to attach to
注解
Passing nullptr is not allowed

成员函数说明

◆ activeWidgetChanged

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

Signal emitted when the active widget changes

参数
oldActiveThe previously active widget (may be nullptr if none)
newActiveThe newly active widget (may be nullptr if none)

◆ borderPen()

QPen QwtFigureWidgetOverlay::borderPen ( ) const

Returns the border pen

返回
The current border pen

◆ cancel()

bool QwtFigureWidgetOverlay::cancel ( )
virtual

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

Cancels the operation

返回
True on success
注解
This function emits finished(true) signal. Override should call this explicitly.
bool MyFigureWidgetOverlay::cancel(){
...
// Explicit call to trigger finished(true)
return true;
}
virtual bool cancel()
Cancels the operation, emits finished(false) signal. Override should call this explicitly
Definition qwt_figure_widget_overlay.cpp:394

◆ controlPointBrush()

QBrush QwtFigureWidgetOverlay::controlPointBrush ( ) const

Returns the control point brush

返回
The current control point brush

◆ controlPointSize()

QSize QwtFigureWidgetOverlay::controlPointSize ( ) const

Returns the control point size (default 8x8)

Returns the control point size

返回
The current control point size (default 8x8)

◆ controlTypeToCursor()

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

Returns the cursor shape based on control type

Get cursor shape based on control type

参数
rrThe control type
返回
The cursor shape

◆ currentActivePlot()

QwtPlot * QwtFigureWidgetOverlay::currentActivePlot ( ) const

Returns the current active plot

返回
The current active plot, nullptr if none or not a plot

◆ currentActiveWidget()

QWidget * QwtFigureWidgetOverlay::currentActiveWidget ( ) const

Returns the current active widget

返回
The current active widget, nullptr if none

◆ drawActiveWidget()

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

Draws the active widget

Draw the active widget

Override this function to change the drawing style. Default drawing calls drawControlLine.

参数
painter
activeW

◆ drawControlLine()

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

Draws the control line

Draw control lines

参数
painter
actualRectActual size
normRectNormalized size

◆ drawOverlay()

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

Draw the widget overlay

参数
painterPainter

实现了 QwtWidgetOverlay.

◆ drawResizeingControlLine()

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

Draws the resizing rubber-band control line

Draw the rubber-band control lines during resize

Override this function to change the drawing style. Default drawing calls drawControlLine.

参数
painter
willSetNormRect

◆ figure()

QwtFigure * QwtFigureWidgetOverlay::figure ( ) const

Returns the associated QwtFigure

返回
The parent QwtFigure

◆ finished

void QwtFigureWidgetOverlay::finished ( bool  isCancel)
signal

Signal emitted when the operation finishes

参数
isCancelWhether the operation was cancelled

◆ 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

参数
[in]posThe point position
[in]regionThe rectangle region
[in]errThe error tolerance
返回
The control type at the given position

◆ hasActiveWidget()

bool QwtFigureWidgetOverlay::hasActiveWidget ( ) const

Checks if there is an active widget

返回
True if there is an active widget, false otherwise

◆ 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

参数
[in]posThe point position
[in]regionThe rectangle region
[in]errThe error tolerance
返回
True if the point is on the edge

◆ isResizing()

bool QwtFigureWidgetOverlay::isResizing ( ) const

Checks if currently resizing

返回
True if resizing, false otherwise

◆ isTransparentForMouseEvents()

bool QwtFigureWidgetOverlay::isTransparentForMouseEvents ( ) const

Checks if the overlay is transparent for mouse events

返回
True if transparent, false otherwise

◆ 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

Must release mouse since it was captured in startResize

◆ selectNextPlot()

void QwtFigureWidgetOverlay::selectNextPlot ( bool  forward = true)

Selects the next plot as the active widget

参数
[in]forwardTrue for forward selection, false for backward

◆ selectNextWidget()

void QwtFigureWidgetOverlay::selectNextWidget ( bool  forward = true)

Selects the next widget as the active widget

参数
[in]forwardTrue for forward selection, false for backward

◆ setActiveWidget

void QwtFigureWidgetOverlay::setActiveWidget ( QWidget *  w)
slot

Changes the active widget

Sets the current active widget

参数
[in]wThe widget to set as active
注解
If w is the same as current active widget, no action is taken
This function emits activeWidgetChanged signal
参见
activeWidgetChanged

◆ setBorderPen()

void QwtFigureWidgetOverlay::setBorderPen ( const QPen &  p)

Sets the border pen

参数
[in]pThe pen to set

◆ setBuiltInFunctionsEnable()

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

Enables or disables built-in functions

参数
[in]flagThe function flag to set
[in]onTrue to enable, false to disable
参见
QwtFigureWidgetOverlay::BuiltInFunctionsFlag

◆ setControlPointBrush()

void QwtFigureWidgetOverlay::setControlPointBrush ( const QBrush &  b)

Sets the control point brush

参数
[in]bThe brush to set

◆ setControlPointSize()

void QwtFigureWidgetOverlay::setControlPointSize ( const QSize &  c)

Sets the control point size

参数
[in]cThe size to set

◆ setTransparentForMouseEvents()

void QwtFigureWidgetOverlay::setTransparentForMouseEvents ( bool  on)

Sets whether the overlay is transparent for mouse events

参数
[in]onTrue to make transparent, false otherwise

◆ showPercentText()

void QwtFigureWidgetOverlay::showPercentText ( bool  on = true)

Shows or hides percentage text

参数
[in]onTrue to show, false to hide

◆ startResize()

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

Helper function to mark the start of resizing

Helper function to start resizing; records the initial resize state

参数
controlType
pos

Capture the mouse to ensure all mouse events are sent to this widget. This is critical to prevent mouse events from being captured by other widgets during mouse movement, which would cause the release event to be missed. grabMouse will:

  • Force all mouse events (move, click, release, etc.) to be sent to this widget
  • Ignore the actual mouse position, even if the mouse moves to other widgets or screen edges
  • Ensure the integrity of the mouse event chain This MUST be paired with releaseMouse (called in mouseReleaseEvent).

Without this function, if the mouse moves over underlying plot widgets or other child widgets, mouse events may be intercepted by those widgets, causing QwtFigureWidgetOverlay to miss mouseReleaseEvent and leaving the state stuck in "resizing".

◆ testBuiltInFunctions()

bool QwtFigureWidgetOverlay::testBuiltInFunctions ( BuiltInFunctionsFlag  flag) const

Tests if a built-in function is enabled

参数
[in]flagThe function flag to test
返回
True if enabled, false otherwise

◆ widgetNormGeometryChanged

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

Signal emitted when widget normalized geometry changes

参数
wThe widget
oldNormGeoThe old normalized geometry
newNormGeoThe new normalized geometry

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