25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
811 B

  1. #ifndef PLCEDITOR_H
  2. #define PLCEDITOR_H
  3. #include <QWidget>
  4. #include <QVBoxLayout>
  5. #include <QListWidget>
  6. #include <QGraphicsScene>
  7. #include <QGraphicsView>
  8. #include <QGraphicsRectItem>
  9. class PLCElement : public QGraphicsRectItem {
  10. public:
  11. enum Type { NormallyOpen, NormallyClosed };
  12. PLCElement(Type type, QGraphicsItem *parent = nullptr);
  13. Type getType() const { return type; }
  14. private:
  15. Type type;
  16. void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
  17. };
  18. class PLCEditor : public QWidget
  19. {
  20. Q_OBJECT
  21. public:
  22. explicit PLCEditor(QWidget *parent = nullptr);
  23. public slots:
  24. void onNormallyOpen();
  25. void onNormallyClosed();
  26. private:
  27. QGraphicsScene* scene;
  28. QGraphicsView* view;
  29. int elementCount;
  30. };
  31. #endif // PLCEDITOR_H