|
- #include "runtime_monitor_window.h"
-
- #include "ui_runtime_monitor_window.h"
-
- #include <QCloseEvent>
- #include <QWidget>
-
- RuntimeMonitorWindow::RuntimeMonitorWindow(QWidget *parent)
- : QMainWindow(parent, Qt::Window),
- ui_(std::make_unique<Ui::RuntimeMonitorWindow>())
- {
- ui_->setupUi(this);
- }
-
- RuntimeMonitorWindow::~RuntimeMonitorWindow() = default;
-
- void RuntimeMonitorWindow::setMonitorWidget(QWidget &widget)
- {
- widget.setParent(ui_->centralWidget);
- ui_->runtimeMonitorWindowLayout->addWidget(&widget);
- }
-
- void RuntimeMonitorWindow::showForRuntime()
- {
- application_exit_ = false;
- runtime_active_ = true;
- showMaximized();
- raise();
- activateWindow();
- }
-
- void RuntimeMonitorWindow::hideForEditing()
- {
- runtime_active_ = false;
- hide();
- }
-
- void RuntimeMonitorWindow::closeForApplicationExit()
- {
- application_exit_ = true;
- runtime_active_ = false;
- close();
- }
-
- void RuntimeMonitorWindow::closeEvent(QCloseEvent *event)
- {
- if (runtime_active_ && !application_exit_)
- {
- emit exitRequested();
- event->ignore();
- return;
- }
- QMainWindow::closeEvent(event);
- }
|