You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nmWATI/Include/iPlot/iPlotCurveT/ZxCmdTool.h

75 lines
1.6 KiB
C

#pragma once
#include <QRectF>
#include <ZxSimpleTool.h>
#include "iPlotCurveT_global.h"
class QPointF;
class ZxRenderItem;
class ZxPlotBase;
/// 通用Tool消息分发
class I_PLOTCURVE_T_EXPORT ZxCmdTool : public ZxSimpleTool
{
Q_OBJECT
public:
ZxCmdTool();
ZxCmdTool(const ZxCmdTool& c);
void setPlotRect(QRectF rc);
void setChartObj(ZxPlotBase* pObj);
protected:
virtual void onPaint(QPainter* painter, const ZxPaintParam& param);
virtual bool onLeftDown(const QPointF& pt);
virtual bool onLeftUp(const QPointF& pt);
virtual bool onMouseMove(const QPointF& pt);
virtual bool onMouseWheel(const QPointF& pt, int delta);
virtual bool onLeftDoubleClick(const QPointF& pt);
virtual void onKeyPress(QKeyEvent *event);
void changeCursor(int nOpType);
signals:
// 鼠标交互式选择点后触发信号允许外界创建Object
void sigTakeMousePts(QVector<QPointF>& vecPts, \
int n, bool& b);
private:
void verifyPos(QPointF& pt);
// 鼠标移动时的辅助信息显示
virtual bool _runShowWithMoving(const QPointF& pt);
// 鼠标Up时的相应操作
virtual bool _runCmdAddObj(const QPointF& pt);
virtual bool _runCmdZoom(const QPointF& pt);
virtual bool _runCmdMove(const QPointF& pt);
virtual bool _runCmdSelect(const QPointF& pt);
virtual bool _runCmdHitPoint(const QPointF& pt);
protected:
bool m_bTracking;
// 图的有效矩形
QPointF m_ptStart;
QPointF m_ptMove;
QRectF m_rtPlot;
QRectF m_rtTracker;
ZxPlotBase* m_pPlot;
QVector<QPointF> m_vecPosPoints;
bool m_bLeftDown;
};