DieItem.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. int getMatrixId() const;
  28. int getDieIndex() const;
  29. void setSelected(bool selected);
  30. void setLeftSelected(bool selected);
  31. void setRightSelected(bool selected);
  32. void updateAppearance();
  33. protected:
  34. void hoverEnterEvent(QGraphicsSceneHoverEvent*) override;
  35. void hoverLeaveEvent(QGraphicsSceneHoverEvent*) override;
  36. // void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
  37. // void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override;
  38. private:
  39. int row, col,matrixId, dieIndex;
  40. ns_mat::PICK_DIE_STATUS status;
  41. bool isSelected = false;
  42. WAFER_MATRIX_POINT_INFO_STRUCT m_info;
  43. // 获取单元格状态颜色
  44. QColor getColorByStatus(ns_mat::PICK_DIE_STATUS status);
  45. };
  46. #endif // DIEITEM_H