CameraModifyScene.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #pragma once
  2. #include "preHeader.h"
  3. #include <qgraphicsscene.h>
  4. #include "CameraGripper.h"
  5. #include "CameraItem.h"
  6. const int CAMERA_SCENE_WIDTH = 3840;
  7. const int CAMERA_SCENE_HEIGHT = 2160;
  8. class CameraModifyScene:public QGraphicsScene
  9. {
  10. Q_OBJECT
  11. public:
  12. //set a constructor
  13. CameraModifyScene(QObject* parent = nullptr);
  14. //set a function to init the connect in scene
  15. void InitConnect();
  16. //mouse press event process slots
  17. void mousePressEvent(QGraphicsSceneMouseEvent* event);
  18. //mouse release event process slots
  19. //void mouseReleaseEvent(QGraphicsSceneMouseEvent* event);
  20. //set a function to add the CameraItem
  21. void AddCameraItem(CameraItem* pItem);
  22. //set a function to remove the CameraItem
  23. void RemoveCameraItem(CameraItem* pItem);
  24. //set a function to get current selected CameraItem
  25. CameraItem* GetCurrentSelectedCameraItem();
  26. //set a function to set the select model
  27. void SetSelectModel(bool bModel);
  28. //set a function to Set the Gripper
  29. void SetGripper(CameraGripper* pGripper);
  30. //set a signal to indicate the CameraItem is delete
  31. signals:
  32. void CameraItemDelete();
  33. //set a signal to indicate the CameraItem is selected
  34. void CameraItemSelected(CameraItem* pItem);
  35. //set a signal to indicate the CameraItem is unselected
  36. void CameraItemUnSelected(CameraItem* pItem);
  37. //set a signal to indicate the CameraItem is modified
  38. void CameraItemModified();
  39. public slots:
  40. //set a slots to process the CameraItem is delete
  41. void OnCameraItemDelete(CameraItem* pItem);
  42. //set a slots to process the CameraItem is selected
  43. void OnCameraItemSelected(CameraItem* pItem);
  44. //set a slots to process the CameraItem is unselected
  45. void OnCameraItemUnSelected(CameraItem* pItem);
  46. //set a slot to process the Mouse is pressed
  47. void OnCameraItemMousePressEvent(CameraItem* pItem);
  48. //set a slot to process the item is modified
  49. void OnCameraItemModified();
  50. private:
  51. //set a function to judge point is in the Rect or not
  52. bool IsPointInRect(QPointF Point, QRectF Rect);
  53. //set a function to rearrange all item in scene
  54. void RearrangeAllItem();
  55. private:
  56. //set a bool to record the select model
  57. //when the select model is true, the CameraItem is single selected
  58. //when the select model is false, the CameraItem is multi selected
  59. bool bSelectModel{true};
  60. //set a CameraGribber pointer
  61. CameraGripper* pCameraGripper{ nullptr };
  62. };