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
969 B

  1. #ifndef HMI_H
  2. #define HMI_H
  3. #include <QGraphicsScene>
  4. #include <QWidget>
  5. #include <project.h>
  6. #include "mygraphicsview.h"
  7. #include "registermanager.h"
  8. namespace Ui {
  9. class HMI;
  10. }
  11. class HMI : public QWidget
  12. {
  13. Q_OBJECT
  14. public:
  15. explicit HMI(QWidget *parent = nullptr);
  16. ~HMI();
  17. void newPage();
  18. void createComponents();
  19. void clearScene();
  20. void applyProjectToScene(const Project& proj, int pageIndex = 0); // 添加页面索引参数
  21. void extractSceneToProject(Project& proj, int pageIndex = 0); // 添加页面索引参数
  22. int currentPageIndex() const; // 获取当前页面索引
  23. protected:
  24. bool eventFilter(QObject *obj, QEvent *event) override;
  25. private slots:
  26. void onListwidgetCurrenttextchanged(const QString &currentText);
  27. private:
  28. Ui::HMI *ui;
  29. QList<QGraphicsScene*> scenes; // 存储多个场景
  30. QList<MyGraphicsView*> views; // 存储多个视图
  31. QString selectedComponentType;
  32. };
  33. #endif // HMI_H