您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

64 行
1.6 KiB

  1. #ifndef MAINWINDOW_H
  2. #define MAINWINDOW_H
  3. #include <QMainWindow>
  4. #include "plc.h"
  5. #include "hmi.h"
  6. #include "modbusmanager.h"
  7. #include "registermanager.h"
  8. QT_BEGIN_NAMESPACE
  9. namespace Ui { class MainWindow; }
  10. class QGraphicsScene;
  11. QT_END_NAMESPACE
  12. class MainWindow : public QMainWindow
  13. {
  14. Q_OBJECT
  15. public:
  16. explicit MainWindow(QWidget *parent = nullptr);
  17. ~MainWindow();
  18. void newPage(bool isPlc);
  19. void createComponents();
  20. void clearScene();
  21. void applyProjectToScene(const Project& proj, int pageIndex = 0); // 添加页面索引参数
  22. void extractSceneToProject(Project& proj, int pageIndex = 0); // 添加页面索引参数
  23. int currentPageIndex() const; // 获取当前页面索引
  24. bool eventFilter(QObject *obj, QEvent *event) override;
  25. private slots:
  26. void plcChange();
  27. void hmiChange();
  28. void newProject();
  29. void openProject();
  30. void saveProject();
  31. void connection();
  32. void disconnection();
  33. void updateConnectionStatus(bool connection);
  34. void onListwidgetCurrenttextchanged(const QString &currentText);
  35. void onTabCloseRequested(int index);
  36. void btnInsertClicked();
  37. private:
  38. Ui::MainWindow *ui;
  39. RegisterManager* registerManager;
  40. ModbusManager* modbusManager;
  41. // PLC状态
  42. QList<QGraphicsScene*> plcScenes;
  43. QList<MyGraphicsView*> plcViews;
  44. QStringList plcPageTitles;
  45. // HMI状态
  46. QList<QGraphicsScene*> hmiScenes;
  47. QList<MyGraphicsView*> hmiViews;
  48. QStringList hmiPageTitles;
  49. QString selectedComponentType;
  50. bool currentIsPLC_ = true;
  51. };
  52. #endif // MAINWINDOW_H