DieItem.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. public:
  16. //DieItem(const WAFER_MATRIX_POINT_INFO_STRUCT& infomation, QGraphicsItem* parent = nullptr);
  17. DieItem(const WAFER_MATRIX_POINT_INFO_STRUCT& info, QGraphicsItem* parent = nullptr)
  18. : QGraphicsRectItem(parent), m_info(info) {
  19. // 设置初始样式
  20. updateAppearance();
  21. // 启用悬停事件
  22. setAcceptHoverEvents(true);
  23. }
  24. // 获取单元格的行列号
  25. int getRow() const;
  26. int getCol() const;
  27. void setSelected(bool selected);
  28. void setLeftSelected(bool selected);
  29. void setRightSelected(bool selected);
  30. void updateAppearance();
  31. protected:
  32. void hoverEnterEvent(QGraphicsSceneHoverEvent*) override;
  33. void hoverLeaveEvent(QGraphicsSceneHoverEvent*) override;
  34. // void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
  35. // void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override;
  36. private:
  37. int row, col;
  38. ns_mat::PICK_DIE_STATUS status;
  39. bool isSelected = false;
  40. WAFER_MATRIX_POINT_INFO_STRUCT m_info;
  41. // 获取单元格状态颜色
  42. QColor getColorByStatus(ns_mat::PICK_DIE_STATUS status);
  43. };
  44. #endif // DIEITEM_H