ControlOperationPage.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. #ifndef VIEWWIDGETGROUP_H
  2. #define VIEWWIDGETGROUP_H
  3. #include <QWidget>
  4. #include <QVBoxLayout>
  5. #include <QstringList.h>
  6. #include "CameraMaterialGroupWnd/MaterialWindow/Wafer.h"
  7. #include "CameraMaterialGroupWnd/MaterialWindow/Waffle.h"
  8. #include "CameraMaterialGroupWnd/MaterialWindow/MaterialBox.h"
  9. #include "CameraMaterialGroupWnd/MaterialWindow/Bond.h"
  10. #include "OriginalWnd/CameraDataHandleAndShow.h"
  11. #include "CameraMaterialGroupWnd/CameraImage/CameraImageHandler.h"
  12. #include "ImageWidget.h"
  13. #include "../common/GlobalUse/JMouseMonitorThread.h"
  14. #include "../CameraBind.h"
  15. #include "ImageView.h"
  16. namespace Ui {
  17. class ControlOperationPage;
  18. }
  19. class ControlOperationPage : public QWidget
  20. {
  21. Q_OBJECT
  22. public:
  23. enum kinds {
  24. wafer_kind,
  25. waffle_kind,
  26. materialbox_kind,
  27. bond_kind
  28. };
  29. explicit ControlOperationPage(QWidget* parent = nullptr);
  30. ~ControlOperationPage();
  31. public:
  32. void initForm();
  33. void updateOperateWidget(const QPixmap& pixmap);
  34. void setDataSources(const QStringList& textList);
  35. void clearLayout();
  36. void updateScale(double newScaleFactor);
  37. void applyScale();
  38. void updateMaterialWidget(kinds materialWndType);
  39. void KindsofWidget(kinds kind);
  40. void setWafer(Wafer* wafer);
  41. void setWaffle(Waffle* waffle);
  42. void setMaterialBox(MaterialBox* materialbox);
  43. void setBond(Bond* bond);
  44. ImageWidget* getOperatewidget();
  45. void resizeSingleUI(bool bMax = false);
  46. void resizeChartsAndCamerasUI();
  47. qreal getScaleFactorValue();
  48. void setScaleFactorSize(QPixmap scaledImage);
  49. /**设置图像缩放
  50. */
  51. QPixmap SetQPixmapScaled(const QPixmap& image);
  52. /*保存原始图像
  53. */
  54. void SetOriginalImage(QPixmap scaledImage);
  55. void setComboBox(const QList<QPair<QString, QString>> fileList, const int index);
  56. void setEnableControls(bool enable);
  57. Wafer* getWafer();
  58. Bond* getBond();
  59. Waffle* getWaffle();
  60. void UpdatemPageGroup(Group* pGroup);
  61. /**更新硬件指针
  62. */
  63. void UpDateCameraBind(CameraBind* pCameraBind);
  64. void setSwitchJoystickButEnable(bool isEnable);
  65. void setBlueBord();
  66. void initImage();
  67. QPixmap getCurrentComboBoxPixmap(const int index);
  68. private slots:
  69. void on_ZoomUpButton_clicked();
  70. void on_ZoomOutButton_clicked();
  71. void on_RulerButton_clicked();
  72. void on_PenButton_clicked();
  73. //void on_PenButton_clicked();
  74. void handleDoubleClick();
  75. void on_switchJoystickBut_clicked();
  76. void on_moduleTypeComboBox_currentIndexChanged(int index);
  77. void on_axisTypeComboBox_currentIndexChanged(int index);
  78. void SaveNewImage();
  79. void on_DataSources_currentIndexChanged(int comboxIndex);
  80. signals:
  81. /**发送轴变化消息
  82. */
  83. void SendModuleTypeSignals(const ST_MOVE_AXIS& _module);
  84. void send_ComboBox_singal(int index);
  85. private slots:
  86. /**位置更新
  87. */
  88. void MouseMovedSlots(const QPoint& delta);
  89. void RequestCursorMoveSlots(const QPoint& pos);
  90. void on_runStopCameraBut_clicked();
  91. protected:
  92. void timerEvent(QTimerEvent* event) override;
  93. /*void mousePressEvent(QMouseEvent* event) override;
  94. void mouseMoveEvent(QMouseEvent* event) override;*/
  95. void wheelEvent(QWheelEvent* event) override;
  96. /*bool eventFilter(QObject* obj, QEvent* event) override;*/
  97. private:
  98. void HideLayout(bool bShow);
  99. void ResetIdleTimer(bool bStart = false);
  100. void InitWnd();
  101. /**创建鼠标控制线程,
  102. * @in isStart== false 关闭
  103. */
  104. void CreateMouseMonitor(bool isStart);
  105. /**鼠标操作
  106. */
  107. void LockMouse(bool islockMouse);
  108. /**更新轴状态
  109. */
  110. void UpdataModuleType(const QString& strMode, int nIndex);
  111. void UpdataRunStopCameraButTip();
  112. private:
  113. template<class T>
  114. void DeduplicationBox(QComboBox* pCom, const T& veTemp, int nIndex);
  115. private:
  116. Ui::ControlOperationPage* ui;
  117. /**当前页面的Group
  118. */
  119. Group* m_pPageSwitchGroup = nullptr;
  120. QPixmap m_currentPixmap;
  121. /**缩放比
  122. */
  123. qreal m_scaleFactor;
  124. QPoint m_mousePos;
  125. OperateMode m_currentMode = ModeImage;
  126. QGraphicsView* m_currentView = nullptr;
  127. double m_previousScaleFactor;
  128. Wafer* m_wafer = nullptr; // 声明Wafer指针
  129. Waffle* m_waffle = nullptr; // 声明Waffle指针
  130. MaterialBox* m_materialbox = nullptr; // 声明materialbox指针
  131. Bond* m_bond = nullptr;
  132. QPointer<ImageView> m_currentImageView = nullptr;
  133. bool m_isEnable;
  134. bool m_bRuler;
  135. QPoint m_pressPos; // 记录鼠标按下位置
  136. /**用作定时使用,后面移动到整个类里面,目前先实现功能
  137. */
  138. int m_idleTimer = -1;
  139. private:
  140. JMouseMonitorThread* m_pMousethread = nullptr;
  141. bool m_bMouseRun = false; // 重复点击
  142. bool m_isUserOnclick = false;
  143. /**硬件指针
  144. */
  145. QPointer<CameraBind> m_pCameraBindCopy;
  146. /**当前选中轴
  147. */
  148. ST_MOVE_AXIS m_currentSelectRunAxis = {};
  149. bool m_isAdd = false;
  150. bool m_isOpenJoystick = true;
  151. bool m_isUpDataImage = false;
  152. };
  153. #endif // VIEWWIDGETGROUP_H