MaterialBox.h 923 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef MATERIALBOX_H
  2. #define MATERIALBOX_H
  3. #include <QApplication>
  4. #include <QWidget>
  5. #include <QPainter>
  6. #include <QMouseEvent>
  7. #include <vector>
  8. #include <QString>
  9. #include <QDebug>
  10. #include "CInterface.h"
  11. #include "MaterialBoxGraphicsView.h"
  12. #include <QFrame>
  13. // 枚举定义:料盒的状态
  14. enum BoxStatus {
  15. Idle, // 空闲
  16. Occupied, // 已占用
  17. };
  18. // 自定义绘制窗口类
  19. class MaterialBox : public QWidget {
  20. public:
  21. MaterialBox(int flag, QWidget *parent = nullptr);
  22. void paintInitFrom(QWidget *parent);
  23. QPixmap getGlobalPixmap() const;
  24. void initFrom(QWidget *parent);
  25. MaterialBoxGraphicsView* view;
  26. QGraphicsScene* scene;
  27. private slots:
  28. void handleLayerRightClicked(int layer);
  29. protected:
  30. void paintEvent(QPaintEvent *event) override;
  31. private:
  32. MATERIAL_BOX_STRUCT boxes; // 所有料盒的数据
  33. QPixmap globalPixmap;
  34. };
  35. #endif // MATERIALBOX_H