#ifndef PLC_H #define PLC_H #include #include #include "modbusmanager.h" #include "project.h" namespace Ui { class PLC; } class PLC : public QWidget { Q_OBJECT public: explicit PLC(RegisterManager* regManager, QWidget *parent = nullptr); ~PLC(); void createComponents(); void clearScene(); void applyProjectToScene(const Project& proj); // 加载工程到scene void extractSceneToProject(Project& proj); // 从scene导出工程数据 protected: bool eventFilter(QObject *obj, QEvent *event) override; public slots: void onListwidgetCurrenttextchanged(const QString ¤tText); void btnInsertClicked(); void updateConnectionStatus(bool connection); private: Ui::PLC *ui; QGraphicsScene *plc_scene_; RegisterManager* registerManager; QString selectedComponentType; }; #endif // PLC_H