ControlOperationPage.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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. void setComboBox(const QList<QPair<QString, QString>> fileList, const int index);
  50. void setEnableControls(bool enable);
  51. /**更新硬件指针
  52. */
  53. void UpDateCameraBind(CameraBind* pCameraBind);
  54. void setSwitchJoystickButEnable(bool isEnable);
  55. void setBlueBord();
  56. void initImage();
  57. QPixmap getCurrentComboBoxPixmap(const int index);
  58. private slots:
  59. void on_ZoomUpButton_clicked();
  60. void on_ZoomOutButton_clicked();
  61. void on_RulerButton_clicked();
  62. void on_PenButton_clicked();
  63. //void on_PenButton_clicked();
  64. void handleDoubleClick();
  65. void on_switchJoystickBut_clicked();
  66. void on_moduleTypeComboBox_currentIndexChanged(int index);
  67. void on_axisTypeComboBox_currentIndexChanged(int index);
  68. void SaveNewImage();
  69. void on_DataSources_currentIndexChanged(int comboxIndex);
  70. signals:
  71. /**发送轴变化消息
  72. */
  73. void SendModuleTypeSignals(const ST_MOVE_AXIS& _module);
  74. void send_ComboBox_singal(int index);
  75. private slots:
  76. /**位置更新
  77. */
  78. void MouseMovedSlots(const QPoint& delta);
  79. void RequestCursorMoveSlots(const QPoint& pos);
  80. protected:
  81. void timerEvent(QTimerEvent* event) override;
  82. /*void mousePressEvent(QMouseEvent* event) override;
  83. void mouseMoveEvent(QMouseEvent* event) override;*/
  84. void wheelEvent(QWheelEvent* event) override;
  85. /*bool eventFilter(QObject* obj, QEvent* event) override;*/
  86. private:
  87. void HideLayout(bool bShow);
  88. void ResetIdleTimer(bool bStart = false);
  89. void InitWnd();
  90. /**创建鼠标控制线程,
  91. * @in isStart== false 关闭
  92. */
  93. void CreateMouseMonitor(bool isStart);
  94. /**鼠标操作
  95. */
  96. void LockMouse(bool islockMouse);
  97. /**更新轴状态
  98. */
  99. void UpdataModuleType(const QString& strMode, int nIndex);
  100. private:
  101. template<class T>
  102. void DeduplicationBox(QComboBox* pCom, const T& veTemp, int nIndex);
  103. private:
  104. Ui::ControlOperationPage* ui;
  105. QPixmap m_currentPixmap;
  106. /**缩放比
  107. */
  108. qreal m_scaleFactor;
  109. QPoint m_mousePos;
  110. OperateMode m_currentMode = ModeImage;
  111. QGraphicsView* m_currentView = nullptr;
  112. double m_previousScaleFactor;
  113. Wafer* m_wafer = nullptr; // 声明Wafer指针
  114. Waffle* m_waffle = nullptr; // 声明Waffle指针
  115. MaterialBox* m_materialbox = nullptr; // 声明materialbox指针
  116. Bond* m_bond = nullptr;
  117. ImageView* m_currentImageView = nullptr;
  118. bool m_isEnable;
  119. bool m_bRuler;
  120. QPoint m_pressPos; // 记录鼠标按下位置
  121. /**用作定时使用,后面移动到整个类里面,目前先实现功能
  122. */
  123. int m_idleTimer = -1;
  124. private:
  125. JMouseMonitorThread* m_pMousethread = nullptr;
  126. bool m_bMouseRun = false; // 重复点击
  127. bool m_isUserOnclick = false;
  128. /**硬件指针
  129. */
  130. QPointer<CameraBind> m_pCameraBindCopy;
  131. /**当前选中轴
  132. */
  133. ST_MOVE_AXIS m_currentSelectRunAxis = {};
  134. bool m_isAdd = false;
  135. };
  136. #endif // VIEWWIDGETGROUP_H