ControlOperationPage.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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. namespace Ui {
  16. class ControlOperationPage;
  17. }
  18. class ControlOperationPage : public QWidget
  19. {
  20. Q_OBJECT
  21. public:
  22. enum kinds{
  23. wafer_kind,
  24. waffle_kind,
  25. materialbox_kind,
  26. bond_kind
  27. };
  28. explicit ControlOperationPage(QWidget *parent = nullptr);
  29. ~ControlOperationPage();
  30. public:
  31. void initForm();
  32. void updateOperateWidget(const QPixmap& pixmap);
  33. void setDataSources(const QStringList& textList);
  34. void clearLayout();
  35. void updateScale(double newScaleFactor);
  36. void applyScale();
  37. void updateMaterialWidget( kinds materialWndType);
  38. void KindsofWidget(kinds kind);
  39. void setWafer(Wafer *wafer);
  40. void setWaffle(Waffle *waffle);
  41. void setMaterialBox(MaterialBox *materialbox);
  42. void setBond(Bond *bond);
  43. ImageWidget* getOperatewidget();
  44. void resizeSingleUI(bool bMax = false);
  45. void resizeChartsAndCamerasUI();
  46. qreal getScaleFactorValue();
  47. void setScaleFactorSize(QPixmap scaledImage);
  48. /**更新硬件指针
  49. */
  50. void UpDateCameraBind(CameraBind* pCameraBind);
  51. void setSwitchJoystickButEnable(bool isEnable);
  52. void setEnableControls(bool enable);
  53. void setBlueBord();
  54. private slots:
  55. void on_ZoomUpButton_clicked();
  56. void on_ZoomOutButton_clicked();
  57. // void on_RulerButton_clicked();
  58. //void on_PenButton_clicked();
  59. void handleDoubleClick();
  60. void on_switchJoystickBut_clicked();
  61. void on_moduleTypeComboBox_currentIndexChanged(int index);
  62. void on_axisTypeComboBox_currentIndexChanged(int index);
  63. signals:
  64. /**发送轴变化消息
  65. */
  66. void SendModuleTypeSignals(const ST_MOVE_AXIS& _module);
  67. private slots:
  68. /**位置更新
  69. */
  70. void MouseMovedSlots(const QPoint& delta);
  71. void RequestCursorMoveSlots(const QPoint& pos);
  72. protected:
  73. void timerEvent(QTimerEvent* event) override;
  74. void mousePressEvent(QMouseEvent* event) override;
  75. void mouseMoveEvent(QMouseEvent* event) override;
  76. void wheelEvent(QWheelEvent* event) override;
  77. bool eventFilter(QObject* obj, QEvent* event) override;
  78. private:
  79. void HideLayout(bool bShow);
  80. void ResetIdleTimer(bool bStart = false);
  81. void InitWnd();
  82. /**创建鼠标控制线程,
  83. * @in isStart== false 关闭
  84. */
  85. void CreateMouseMonitor(bool isStart);
  86. /**鼠标操作
  87. */
  88. void LockMouse(bool islockMouse);
  89. /**更新轴状态
  90. */
  91. void UpdataModuleType(const QString& strMode,int nIndex);
  92. private:
  93. template<class T>
  94. void DeduplicationBox(QComboBox* pCom, const T& veTemp, int nIndex);
  95. private:
  96. Ui::ControlOperationPage* ui;
  97. QPixmap m_currentPixmap;
  98. qreal m_scaleFactor;
  99. QPoint m_mousePos;
  100. OperateMode m_currentMode = ModeImage;
  101. QGraphicsView* m_currentView = nullptr;
  102. double m_previousScaleFactor;
  103. Wafer* m_wafer = nullptr; // 声明Wafer指针
  104. Waffle* m_waffle = nullptr; // 声明Waffle指针
  105. MaterialBox* m_materialbox = nullptr; // 声明materialbox指针
  106. Bond* m_bond = nullptr;
  107. /**用作定时使用,后面移动到整个类里面,目前先实现功能
  108. */
  109. int m_idleTimer = -1;
  110. private:
  111. JMouseMonitorThread* m_pMousethread = nullptr;
  112. bool m_bMouseRun = false; // 重复点击
  113. bool m_isUserOnclick = false;
  114. /**硬件指针
  115. */
  116. QPointer<CameraBind> m_pCameraBindCopy;
  117. /**当前选中轴
  118. */
  119. ST_MOVE_AXIS m_currentSelectRunAxis = {};
  120. bool m_isAdd = false;
  121. };
  122. #endif // VIEWWIDGETGROUP_H