You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
890 B

  1. #ifndef PLC_H
  2. #define PLC_H
  3. #include <QGraphicsScene>
  4. #include <QWidget>
  5. #include "modbusmanager.h"
  6. #include "project.h"
  7. namespace Ui {
  8. class PLC;
  9. }
  10. class PLC : public QWidget
  11. {
  12. Q_OBJECT
  13. public:
  14. explicit PLC(RegisterManager* regManager, QWidget *parent = nullptr);
  15. ~PLC();
  16. void createComponents();
  17. void clearScene();
  18. void applyProjectToScene(const Project& proj); // 加载工程到scene
  19. void extractSceneToProject(Project& proj); // 从scene导出工程数据
  20. protected:
  21. bool eventFilter(QObject *obj, QEvent *event) override;
  22. public slots:
  23. void onListwidgetCurrenttextchanged(const QString &currentText);
  24. void btnInsertClicked();
  25. void updateConnectionStatus(bool connection);
  26. private:
  27. Ui::PLC *ui;
  28. QGraphicsScene *plc_scene_;
  29. RegisterManager* registerManager;
  30. QString selectedComponentType;
  31. };
  32. #endif // PLC_H