123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- #ifndef DIEITEM_H
- #define DIEITEM_H
- #pragma once
- #include <QGraphicsRectItem>
- #include <QColor>
- #include <QDebug>
- #include <QPen>
- #include <QMenu>
- #include <QGraphicsSceneContextMenuEvent>
- #include "CMatrixCommon.h"
- #include <CWaferMatrix.h>
- #include <CViewInterface.h>
- // 自定义矩形代表晶圆单元格
- class DieItem : public QObject, public QGraphicsRectItem {
- public:
- //DieItem(const WAFER_MATRIX_POINT_INFO_STRUCT& infomation, QGraphicsItem* parent = nullptr);
- DieItem(const WAFER_MATRIX_POINT_INFO_STRUCT& info, QGraphicsItem* parent = nullptr)
- : QGraphicsRectItem(parent), m_info(info) {
- // 设置初始样式
- updateAppearance();
- // 启用悬停事件
- setAcceptHoverEvents(true);
- }
- // 获取单元格的行列号
- int getRow() const;
- int getCol() const;
- void setSelected(bool selected);
- void setLeftSelected(bool selected);
- void setRightSelected(bool selected);
- void updateAppearance();
- protected:
- void hoverEnterEvent(QGraphicsSceneHoverEvent*) override;
- void hoverLeaveEvent(QGraphicsSceneHoverEvent*) override;
- // void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
- // void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override;
- private:
- int row, col;
- ns_mat::PICK_DIE_STATUS status;
- bool isSelected = false;
- WAFER_MATRIX_POINT_INFO_STRUCT m_info;
- // 获取单元格状态颜色
- QColor getColorByStatus(ns_mat::PICK_DIE_STATUS status);
- };
- #endif // DIEITEM_H
|