123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- #pragma once
- #include "preHeader.h"
- #include <qgraphicsscene.h>
- #include "CameraGripper.h"
- #include "CameraItem.h"
- const int CAMERA_SCENE_WIDTH = 3840;
- const int CAMERA_SCENE_HEIGHT = 2160;
- class CameraModifyScene:public QGraphicsScene
- {
- Q_OBJECT
- public:
- //set a constructor
- CameraModifyScene(QObject* parent = nullptr);
- //set a function to init the connect in scene
- void InitConnect();
- //mouse press event process slots
- void mousePressEvent(QGraphicsSceneMouseEvent* event);
- //mouse release event process slots
- //void mouseReleaseEvent(QGraphicsSceneMouseEvent* event);
- //set a function to add the CameraItem
- void AddCameraItem(CameraItem* pItem);
- //set a function to remove the CameraItem
- void RemoveCameraItem(CameraItem* pItem);
- //set a function to get current selected CameraItem
- CameraItem* GetCurrentSelectedCameraItem();
- //set a function to set the select model
- void SetSelectModel(bool bModel);
- //set a function to Set the Gripper
- void SetGripper(CameraGripper* pGripper);
- //set a signal to indicate the CameraItem is delete
- signals:
- void CameraItemDelete();
- //set a signal to indicate the CameraItem is selected
- void CameraItemSelected(CameraItem* pItem);
- //set a signal to indicate the CameraItem is unselected
- void CameraItemUnSelected(CameraItem* pItem);
- //set a signal to indicate the CameraItem is modified
- void CameraItemModified();
-
- public slots:
- //set a slots to process the CameraItem is delete
- void OnCameraItemDelete(CameraItem* pItem);
- //set a slots to process the CameraItem is selected
- void OnCameraItemSelected(CameraItem* pItem);
- //set a slots to process the CameraItem is unselected
- void OnCameraItemUnSelected(CameraItem* pItem);
- //set a slot to process the Mouse is pressed
- void OnCameraItemMousePressEvent(CameraItem* pItem);
- //set a slot to process the item is modified
- void OnCameraItemModified();
-
- private:
- //set a function to judge point is in the Rect or not
- bool IsPointInRect(QPointF Point, QRectF Rect);
- //set a function to rearrange all item in scene
- void RearrangeAllItem();
- private:
- //set a bool to record the select model
- //when the select model is true, the CameraItem is single selected
- //when the select model is false, the CameraItem is multi selected
- bool bSelectModel{true};
- //set a CameraGribber pointer
- CameraGripper* pCameraGripper{ nullptr };
- };
|