DieItem.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #ifndef DIEITEM_H
  2. #define DIEITEM_H
  3. #pragma once
  4. #include <QGraphicsRectItem>
  5. #include <QColor>
  6. #include <QDebug>
  7. #include <QPen>
  8. #include <QMenu>
  9. #include <QGraphicsSceneContextMenuEvent>
  10. #include "CMatrixCommon.h"
  11. #include <CWaferMatrix.h>
  12. #include <CViewInterface.h>
  13. // 自定义矩形代表晶圆单元格
  14. class DieItem : public QObject, public QGraphicsRectItem
  15. {
  16. public:
  17. //DieItem(const WAFER_MATRIX_POINT_INFO_STRUCT& infomation, QGraphicsItem* parent = nullptr);
  18. DieItem(const WAFER_MATRIX_POINT_INFO_STRUCT& info, QGraphicsItem* parent = nullptr)
  19. : QGraphicsRectItem(parent), m_info(info)
  20. {
  21. // 设置初始样式
  22. updateAppearance();
  23. // 启用悬停事件
  24. setAcceptHoverEvents(true);
  25. }
  26. // 获取单元格的行列号
  27. int getRow() const;
  28. int getCol() const;
  29. int getMatrixId() const;
  30. int getDieIndex() const;
  31. void setSelected(bool selected);
  32. void setLeftSelected(bool selected);
  33. void setRightSelected(bool selected);
  34. void updateAppearance();
  35. protected:
  36. void hoverEnterEvent(QGraphicsSceneHoverEvent*) override;
  37. void hoverLeaveEvent(QGraphicsSceneHoverEvent*) override;
  38. // void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
  39. // void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override;
  40. private:
  41. int row, col,matrixId, dieIndex;
  42. ns_mat::PICK_DIE_STATUS status;
  43. bool isSelected = false;
  44. WAFER_MATRIX_POINT_INFO_STRUCT m_info;
  45. // 获取单元格状态颜色
  46. QColor getColorByStatus(ns_mat::PICK_DIE_STATUS status);
  47. };
  48. #endif // DIEITEM_H