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.

41 line
1015 B

  1. #ifndef MAINWINDOW_H
  2. #define MAINWINDOW_H
  3. #include <QMainWindow>
  4. #include <QTabWidget>
  5. #include <QToolBar>
  6. #include "document.h"
  7. QT_BEGIN_NAMESPACE
  8. namespace Ui { class MainWindow; }
  9. QT_END_NAMESPACE
  10. class MainWindow : public QMainWindow
  11. {
  12. Q_OBJECT
  13. public:
  14. MainWindow(QWidget *parent = nullptr);
  15. ~MainWindow();
  16. protected:
  17. bool eventFilter(QObject *obj, QEvent *event) override;
  18. private slots:
  19. void onNewHMI(); // 新建HMI文档
  20. void onNewPLC(); // 新建PLC文档
  21. void onTabChanged(int idx); // 标签页切换时更新工具栏
  22. private:
  23. void createMenus(); // 创建菜单栏
  24. void createToolbars(); // 创建工具栏(左侧)
  25. void updateToolBar(BaseDocument *doc); // 根据文档类型更新工具栏
  26. QTabWidget *m_tabWidget; // 多文档标签页
  27. QToolBar *m_leftToolBar; // 左侧工具栏
  28. int m_hmiCount = 0; // HMI文档计数器
  29. int m_plcCount = 0; // PLC文档计数器
  30. };
  31. #endif // MAINWINDOW_H