123456789101112131415161718192021222324252627282930313233343536373839404142 |
- #pragma once
- #include <qgraphicsview.h>
- #include <qevent.h>
- class CameraItemView :
- public QGraphicsView
- {
- Q_OBJECT;
- public:
- //define a constructor
- CameraItemView(QWidget* parent = nullptr);
- //define a destructor
- ~CameraItemView();
- //define a function to achieve the mouse press event
- void mousePressEvent(QMouseEvent* event);
- //define a function to achieve the mouse release event
- void mouseReleaseEvent(QMouseEvent* event);
- //define a function to achieve the mouse move event
- void mouseMoveEvent(QMouseEvent* event);
- //define a function to achieve the mouse wheel event
- void wheelEvent(QWheelEvent* event);
- public:
- //define a Point to record the View Center Point
- //QPointF m_ViewCenterPoint;
- //define two float to record the View Scale
- float m_fViewScaleX;
- float m_fViewScaleY;
- //define a bool to indicate the mouse is pressed or not
- bool m_bMousePressed;
- //define a Point to record the mouse press point
- QPointF m_MousePressPoint;
- //define a Point to record the mouse move current point
- QPointF m_MouseMoveCurrentPoint;
- //define a point to record the view center point
- QPointF m_ViewCenterPoint;
- };
|