QWT 7.0.1
Loading...
Searching...
No Matches
qwt_plot_scale_event_dispatcher.h
1#ifndef QWTPLOTSCALEEVENTDISPATCHER_H
2#define QWTPLOTSCALEEVENTDISPATCHER_H
3#include <QObject>
4#include "qwt_global.h"
5#include "qwt_axis_id.h"
6class QMouseEvent;
7class QWheelEvent;
8class QwtPlot;
23class QWT_EXPORT QwtPlotScaleEventDispatcher : public QObject
24{
25 Q_OBJECT
26 QWT_DECLARE_PRIVATE(QwtPlotScaleEventDispatcher)
27public:
28 explicit QwtPlotScaleEventDispatcher(QwtPlot* plot, QObject* par = nullptr);
30 bool isEnable() const;
31 // 获取 QwtScaleWidget 对应的轴 ID
32 static QwtAxisId findAxisIdByScaleWidget(const QwtPlot* plot, const QwtScaleWidget* scaleWidget);
33public Q_SLOTS:
34 void updateCache();
35 // 设置可用
36 void setEnable(bool on = true);
37
38protected:
39 virtual bool eventFilter(QObject* obj, QEvent* e) override;
40 // 更新数据
41 void rebuildCache();
42 // 处理各种鼠标事件
43 virtual bool handleMousePress(QwtPlot* bindPlot, QMouseEvent* e);
44 virtual bool handleMouseMove(QwtPlot* bindPlot, QMouseEvent* e);
45 virtual bool handleMouseRelease(QwtPlot* bindPlot, QMouseEvent* e);
46 virtual bool handleWheelEvent(QwtPlot* bindPlot, QWheelEvent* e);
47 // 查找应该处理事件的 scale widget
48 QwtScaleWidget* findTargetOnScale(const QPoint& pos);
49};
50
51#endif // QWTPLOTSCALEEVENTDISPATCHER_H
针对寄生绘图的事件过滤器,主要处理坐标轴动作
Definition qwt_plot_scale_event_dispatcher.h:24
A 2-D plotting widget.
Definition qwt_plot.h:99
A Widget which contains a scale.
Definition qwt_scale_widget.h:74