ControlOperationPage.h 4.6 KB

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