#ifndef WAFERGRAPHICSVIEW_H #define WAFERGRAPHICSVIEW_H #include #include #include #include #include "DieItem.h" #include #include #include class WaferGraphicsView : public QGraphicsView { Q_OBJECT public: WaferGraphicsView(QGraphicsScene* scene, QWidget* parent = nullptr); void initWafer(const QPointF& center, double radius, int dieWidth, int dieHeight); void addDiePoint(const QPointF& diePos,const WAFER_MATRIX_POINT_INFO_STRUCT& dieInfo); void drawDieMatrix(const QPointF& center, int Width, int Height); protected: void mousePressEvent(QMouseEvent* event) override; void mouseMoveEvent(QMouseEvent* event) override; void mouseReleaseEvent(QMouseEvent* event) override; void wheelEvent(QWheelEvent* event) override; bool eventFilter(QObject *obj, QEvent *event) override; private: bool selecting; // 是否正在框选 QPoint lastPos; QPointF selectionStart; // 框选起点 QGraphicsRectItem* selectionRect; // 框选矩形 double scaleFactor; // 当前缩放比例 bool isDragging = false; QMap, QGraphicsItem*> selectedItemsMap; QLabel *thumbnailLabel; // 缩略图标签 bool thumbnailVisible; // 缩略图可见状态 QPair topLeftIndex; QPair bottomRightIndex; QPointer selectedItem; QPointer topLeftItem; QPointer bottomRightItem; QGraphicsScene* m_scene; QPointF m_center; double m_radius; QSize m_dieSize; QHash m_dieItems; // 通过ID快速访问 void showThumbnail(); void hideThumbnail(); void checkAndCreateRegion(); void clearRegion(); void setRegion(); }; #endif // WAFERGRAPHICSVIEW_H