SingleCameraOperationWnd.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #pragma once
  2. #ifndef SINGLECAMERAOPERATIONWND_H
  3. #define SINGLECAMERAOPERATIONWND_H
  4. #include <QMainWindow>
  5. #include <QSlider>
  6. #include <QLineEdit>
  7. #include "CameraMaterialGroupWnd/MaterialWindow/Wafer.h"
  8. #include "CameraMaterialGroupWnd/MaterialWindow/Waffle.h"
  9. #include "CameraMaterialGroupWnd/MaterialWindow/MaterialBox.h"
  10. #include "CameraDataHandleAndShow.h"
  11. #include "CameraMaterialGroupWnd/CameraImage/CameraImageHandler.h"
  12. #include "CameraMaterialGroupWnd/MaterialWindow/DraggableLine.h"
  13. #include "JOriginalMainWnd.h"
  14. namespace Ui {
  15. class SingleCameraOperationWnd;
  16. }
  17. class SingleCameraOperationWnd : public JOriginalMainWnd
  18. {
  19. Q_OBJECT
  20. public:
  21. explicit SingleCameraOperationWnd(QWidget *parent = nullptr);
  22. ~SingleCameraOperationWnd();
  23. void initFrom();
  24. void closeEvent(QCloseEvent *event) override;
  25. void loadGroupSettings(int Id, int Index);
  26. void startCamera(int cameraId);
  27. void stopCamera(int cameraId);
  28. void updateImage(const QImage&image);
  29. void updateMaterialWidget(int materialWndType, int groupId);
  30. public slots: // 确保这里声明了槽函数
  31. // void onComboBoxIndexChanged(int index); // 确保签名匹配
  32. QString getImagePathFromIndex(int index);
  33. void on_DatacomboBox_currentIndexChanged(int index);
  34. //void handleComBoxChange(int groupId,int index);
  35. void loadLiveVedio();
  36. protected:
  37. void wheelEvent(QWheelEvent *event) override;
  38. void loadSettings();
  39. void checkSettings();
  40. void showEvent(QShowEvent *event) override;
  41. void hideEvent(QHideEvent *event) override;
  42. private slots:
  43. QPixmap getCurrentPixmap() const {
  44. return currentPixmap;
  45. }
  46. public:
  47. /**必须绑定它, 没必要一直new ,只是控制
  48. */
  49. virtual void InitMainCameraBind(CameraBind* pCameraBind);
  50. virtual void UpdateCameraDisplay0(int iCameraId, JVision::ImageInfo imageData);
  51. virtual void UpdateCameraDisplay1(int iCameraId, JVision::ImageInfo imageData);
  52. virtual void UpdateCameraDisplay2(int iCameraId, JVision::ImageInfo imageData);
  53. virtual void UpdateCameraDisplay3(int iCameraId, JVision::ImageInfo imageData);
  54. virtual void UpdateCameraDisplay4(int iCameraId, JVision::ImageInfo imageData);
  55. private :
  56. Ui::SingleCameraOperationWnd *ui;
  57. QPixmap currentPixmap;
  58. qreal scaleFactor;
  59. int lastGroupId = -1;
  60. int lastIndex = -1;
  61. Wafer *wafer; // 声明Wafer指针
  62. Waffle *waffle; // 声明Waffle指针
  63. MaterialBox *materialbox; // 声明materialbox指针
  64. bool isShow;
  65. ImageGrabber *m_grabber;
  66. QMap<int, Group*> groupMap;
  67. int currentCameraId;
  68. QMap<int, Wafer*> waferMap;
  69. QMap<int, Waffle*> waffleMap;
  70. QMap<int, MaterialBox*> materialBoxMap;
  71. OperateMode currentMode = ModeImage;
  72. QGraphicsView *currentView = nullptr;
  73. QPoint mousePos;
  74. double previousScaleFactor;
  75. void updateScale(double newScaleFactor); // 更新缩放比例
  76. void applyScale(); // 应用缩放
  77. bool liveClick;
  78. };
  79. #endif // SINGLECAMERAOPERATIONWND_H