QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt_figure_widget_overlay.h
1#ifndef QWTFIGUREWIDGETOVERLAY_H
2#define QWTFIGUREWIDGETOVERLAY_H
3#include "qwt_widget_overlay.h"
4// Qt
5class QEvent;
6class QMouseEvent;
7class QHoverEvent;
8class QKeyEvent;
9// Qwt
10class QwtFigure;
11class QwtPlot;
12
25{
26 Q_OBJECT
27 QWT_DECLARE_PRIVATE(QwtFigureWidgetOverlay)
28public:
33 {
34 ControlLineTop,
35 ControlLineBottom,
36 ControlLineLeft,
37 ControlLineRight,
38 ControlPointTopLeft,
39 ControlPointTopRight,
40 ControlPointBottomLeft,
41 ControlPointBottomRight,
42 Inner,
43 OutSide
44 };
45 Q_ENUM(ControlType)
46
47
51 {
52 FunSelectCurrentPlot = 1,
53 FunResizePlot = 2
54 };
55 Q_ENUM(BuiltInFunctionsFlag)
56 Q_DECLARE_FLAGS(BuiltInFunctions, BuiltInFunctionsFlag)
57 Q_FLAG(BuiltInFunctions)
58
59public:
61 explicit QwtFigureWidgetOverlay(QwtFigure* fig);
62 ~QwtFigureWidgetOverlay() override;
64 QwtFigure* figure() const;
65 void setTransparentForMouseEvents(bool on);
66 bool isTransparentForMouseEvents() const;
67
68public:
70 static Qt::CursorShape controlTypeToCursor(ControlType rr);
72 static ControlType getPositionControlType(const QPoint& pos, const QRect& region, int err = 1);
74 static bool isPointInRectEdget(const QPoint& pos, const QRect& region, int err = 1);
76 void setBuiltInFunctionsEnable(BuiltInFunctionsFlag flag, bool on = true);
78 bool testBuiltInFunctions(BuiltInFunctionsFlag flag) const;
80 bool hasActiveWidget() const;
82 bool isResizing() const;
84 void setBorderPen(const QPen& p);
86 QPen borderPen() const;
88 void setControlPointBrush(const QBrush& b);
90 QBrush controlPointBrush() const;
92 void setControlPointSize(const QSize& c);
94 QSize controlPointSize() const;
96 void selectNextWidget(bool forward = true);
98 void selectNextPlot(bool forward = true);
100 QWidget* currentActiveWidget() const;
102 QwtPlot* currentActivePlot() const;
104 void showPercentText(bool on = true);
106 virtual bool cancel();
107public Q_SLOTS:
109 void setActiveWidget(QWidget* w);
110
111protected:
112 virtual void drawOverlay(QPainter* p) const override;
113 virtual QRegion maskHint() const override;
115 virtual void drawActiveWidget(QPainter* painter, QWidget* activeW) const;
117 virtual void drawResizeingControlLine(QPainter* painter, const QRectF& willSetNormRect) const;
119 virtual void drawControlLine(QPainter* painter, const QRect& actualRect, const QRectF& normRect) const;
121 void startResize(ControlType controlType, const QPoint& pos);
122
123protected:
124 void mouseMoveEvent(QMouseEvent* me) override;
125 void mouseReleaseEvent(QMouseEvent* me) override;
126 void mousePressEvent(QMouseEvent* me) override;
127 void keyPressEvent(QKeyEvent* ke) override;
128Q_SIGNALS:
129
136 void widgetNormGeometryChanged(QWidget* w, const QRectF& oldNormGeo, const QRectF& newNormGeo);
137
143 void activeWidgetChanged(QWidget* oldActive, QWidget* newActive);
144
149 void finished(bool isCancel);
150private Q_SLOTS:
151 void onAxesRemove(QwtPlot* removedAxes);
152};
153
154#endif // QWTFIGUREWIDGETOVERLAY_H
An overlay widget for QwtFigure that provides interactive manipulation
Definition qwt_figure_widget_overlay.h:25
void finished(bool isCancel)
Signal emitted when the operation finishes
void activeWidgetChanged(QWidget *oldActive, QWidget *newActive)
Signal emitted when the active widget changes
ControlType
Enum for marking rectangular control regions
Definition qwt_figure_widget_overlay.h:33
void widgetNormGeometryChanged(QWidget *w, const QRectF &oldNormGeo, const QRectF &newNormGeo)
Signal emitted when widget normalized geometry changes
BuiltInFunctionsFlag
Built-in functionality flags
Definition qwt_figure_widget_overlay.h:51
A figure container for organizing Qwt plots with flexible layout options
Definition qwt_figure.h:47
A 2-D plotting widget
Definition qwt_plot.h:99
An overlay for a widget
Definition qwt_widget_overlay.h:59
virtual void drawOverlay(QPainter *painter) const =0
Draw the widget overlay
virtual QRegion maskHint() const
Calculate an approximation for the mask
Definition qwt_widget_overlay.cpp:363