ControlOperationPage.h 4.6 KB

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