#pragma once #include #include #include "ZxSimpleTool.h" #include "Defines.h" #include "iPlotCurveT_global.h" class ZxRenderItem; class ZxObjBase; /// 工具类的再次封装 class I_PLOTCURVE_T_EXPORT ZxObjToolBase : public ZxSimpleTool { Q_OBJECT public: ZxObjToolBase(); // ~ZxObjToolBase(); void setChartObj(ZxObjBase* pObj); public: virtual bool onLeftDown(const QPointF& pt); virtual bool onLeftUp(const QPointF& pt); virtual bool onRightDown(const QPointF& pt); virtual bool onRightUp(const QPointF& pt); virtual bool onMouseMove(const QPointF& pt); virtual bool onMouseWheel(const QPointF& pt, int delta); virtual void onPaint(QPainter* painter, const ZxPaintParam& param); virtual void onPaintHandles(QPainter* painter, const ZxPaintParam& param); protected: virtual Qt::CursorShape getCursorBy(const int& nOption, const int& nSubIndex); virtual void changeCursor(Qt::CursorShape oShape, bool bMoveActivated = false); virtual void restoreCursor(); protected: ZxObjBase* m_pObj; // 鼠标交互相关 bool m_bTracking; QRectF m_rtTracker; QPointF m_ptStart; QPointF m_ptMove; ObjHitOption m_oHitOption; Qt::CursorShape m_oOldShape; };