综合平台编程器项目的远程存储
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.
 
 
 
 

55 lines
1.1 KiB

  1. #include "runtime_monitor_window.h"
  2. #include "ui_runtime_monitor_window.h"
  3. #include <QCloseEvent>
  4. #include <QWidget>
  5. RuntimeMonitorWindow::RuntimeMonitorWindow(QWidget *parent)
  6. : QMainWindow(parent, Qt::Window),
  7. ui_(std::make_unique<Ui::RuntimeMonitorWindow>())
  8. {
  9. ui_->setupUi(this);
  10. }
  11. RuntimeMonitorWindow::~RuntimeMonitorWindow() = default;
  12. void RuntimeMonitorWindow::setMonitorWidget(QWidget &widget)
  13. {
  14. widget.setParent(ui_->centralWidget);
  15. ui_->runtimeMonitorWindowLayout->addWidget(&widget);
  16. }
  17. void RuntimeMonitorWindow::showForRuntime()
  18. {
  19. application_exit_ = false;
  20. runtime_active_ = true;
  21. showMaximized();
  22. raise();
  23. activateWindow();
  24. }
  25. void RuntimeMonitorWindow::hideForEditing()
  26. {
  27. runtime_active_ = false;
  28. hide();
  29. }
  30. void RuntimeMonitorWindow::closeForApplicationExit()
  31. {
  32. application_exit_ = true;
  33. runtime_active_ = false;
  34. close();
  35. }
  36. void RuntimeMonitorWindow::closeEvent(QCloseEvent *event)
  37. {
  38. if (runtime_active_ && !application_exit_)
  39. {
  40. emit exitRequested();
  41. event->ignore();
  42. return;
  43. }
  44. QMainWindow::closeEvent(event);
  45. }