DieItem.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef DIEITEM_H
  2. #define DIEITEM_H
  3. #include <QGraphicsRectItem>
  4. #include <QColor>
  5. #include <QDebug>
  6. #include <QPen>
  7. #include <QMenu>
  8. #include <QGraphicsSceneContextMenuEvent>
  9. enum PICK_DIE_STATUS {
  10. DIE_EXIST,/*原来的*/
  11. PICK_ING,/*正在取*/
  12. NO_EXIST,/*已取走*/
  13. SKIP_DIE,/*跳过的点*/
  14. EDGE_DIE /*边缘无效*/
  15. };
  16. // 自定义矩形代表晶圆单元格
  17. class DieItem : public QObject, public QGraphicsRectItem {
  18. public:
  19. DieItem(int row, int col, PICK_DIE_STATUS status, qreal size, QGraphicsItem* parent = nullptr);
  20. // 获取单元格的行列号
  21. int getRow() const;
  22. int getCol() const;
  23. void setSelected(bool selected);
  24. void setLeftSelected(bool selected);
  25. void setRightSelected(bool selected);
  26. protected:
  27. // void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
  28. // void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override;
  29. private:
  30. int row, col;
  31. PICK_DIE_STATUS status;
  32. bool isSelected = false;
  33. // 获取单元格状态颜色
  34. QColor getColorByStatus(PICK_DIE_STATUS status);
  35. // void handleAction1();
  36. // void handleAction2();
  37. };
  38. #endif // DIEITEM_H