#ifndef DIEITEM_H
#define DIEITEM_H

#include <QGraphicsRectItem>
#include <QColor>
#include <QDebug>
#include <QPen>
#include <QMenu>
#include <QGraphicsSceneContextMenuEvent>

enum PICK_DIE_STATUS {
    DIE_EXIST,/*原来的*/
    PICK_ING,/*正在取*/
    NO_EXIST,/*已取走*/
    SKIP_DIE,/*跳过的点*/
    EDGE_DIE /*边缘无效*/
};

// 自定义矩形代表晶圆单元格
class DieItem : public QObject, public QGraphicsRectItem {
public:
    DieItem(int row, int col, PICK_DIE_STATUS status, qreal size, QGraphicsItem* parent = nullptr);

    // 获取单元格的行列号
    int getRow() const;
    int getCol() const;

    void setSelected(bool selected);

protected:
           // void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
           // void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override;

private:
    int row, col;
    PICK_DIE_STATUS status;
    bool isSelected = false;

    // 获取单元格状态颜色
    QColor getColorByStatus(PICK_DIE_STATUS status);

    // void handleAction1();
    // void handleAction2();
};

#endif // DIEITEM_H
