SingleCameraOperationWnd.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. namespace Ui {
  14. class SingleCameraOperationWnd;
  15. }
  16. class SingleCameraOperationWnd : public QMainWindow
  17. {
  18. Q_OBJECT
  19. public:
  20. explicit SingleCameraOperationWnd(QWidget *parent = nullptr);
  21. ~SingleCameraOperationWnd();
  22. void initFrom();
  23. void connectSliderAndLineEdit(QSlider* slider, QLineEdit* lineEdit);
  24. void initSliders();
  25. void initLineEdits();
  26. void initProgressBar();
  27. // void saveSliderStates();
  28. // void loadSliderStates();
  29. void closeEvent(QCloseEvent *event) override;
  30. void loadGroupSettings(int Id, int Index);
  31. void clearLayout(); // 清除大窗口上当前的布局
  32. void WaferWidget(); // 圆晶
  33. void WaffleWidget(); // 华夫盒
  34. void MaterialBoxWidget(); // 料盒
  35. void startCamera(int cameraId);
  36. void stopCamera(int cameraId);
  37. void updateImage(const QImage&image);
  38. public slots: // 确保这里声明了槽函数
  39. void onComboBoxIndexChanged(int index); // 确保签名匹配
  40. QString getImagePathFromIndex(int index);
  41. void handleDoubleClick();
  42. void showAndHideButton();
  43. void on_DatacomboBox_currentIndexChanged(int index);
  44. void handleComBoxChange(int groupId,int index);
  45. void loadLiveVedio();
  46. protected:
  47. void wheelEvent(QWheelEvent *event) override;
  48. void loadSettings();
  49. void checkSettings();
  50. void showEvent(QShowEvent *event) override;
  51. void hideEvent(QHideEvent *event) override;
  52. private slots:
  53. void on_ZoomUpButton_clicked();
  54. QPixmap getCurrentPixmap() const {
  55. return currentPixmap;
  56. }
  57. void on_ZoomOutButton_clicked();
  58. void on_RulerButton_clicked();
  59. private : Ui::SingleCameraOperationWnd *ui;
  60. QPixmap currentPixmap;
  61. qreal scaleFactor;
  62. int lastGroupId = -1;
  63. int lastIndex = -1;
  64. Wafer *wafer; // 声明Wafer指针
  65. Waffle *waffle; // 声明Waffle指针
  66. MaterialBox *materialbox; // 声明materialbox指针
  67. bool isShow;
  68. ImageGrabber *m_grabber;
  69. QMap<int, Group*> groupMap;
  70. int currentCameraId;
  71. QMap<int, Wafer*> waferMap;
  72. QMap<int, Waffle*> waffleMap;
  73. QMap<int, MaterialBox*> materialBoxMap;
  74. OperateMode currentMode = ModeImage;
  75. QGraphicsView *currentView = nullptr;
  76. QPoint mousePos;
  77. double previousScaleFactor;
  78. void updateScale(double newScaleFactor); // 更新缩放比例
  79. void applyScale(); // 应用缩放
  80. bool liveClick;
  81. QGraphicsScene* operateScene; // 图形场景
  82. DraggableLine* currentLine; // 当前线段
  83. };
  84. #endif // SINGLECAMERAOPERATIONWND_H