11#include " ResultWindow.hpp"
22#include " OutputWidget.hpp"
33#include " pre/utils/UserSettings.hpp"
4+ #include < QCloseEvent>
45#include < QMenuBar>
56#include < QMessageBox>
67#include < QFileDialog>
78
8- ResultWindow::ResultWindow (const QString& filePath, const BowResult& data) {
9+ ResultWindow::ResultWindow (const QString& filePath, const BowResult& data, QWidget* parent):
10+ QMainWindow(parent)
11+ {
912 // Main window properties
10- this -> setWindowFilePath (filePath);
11- this -> setWindowIcon (QIcon (" :/icons/logo.svg" ));
12- this -> setStyleSheet (" QMainWindow { background-image:url(:/icons/background.png); background-position: center; background-repeat: no-repeat; }" );
13- this -> menuBar ()->setAutoFillBackground (true );
14- this -> resize ({1000 , 700 }); // Initial size, overwritten by stored window geometry if present
13+ setWindowFilePath (filePath);
14+ setWindowIcon (QIcon (" :/icons/logo.svg" ));
15+ setStyleSheet (" QMainWindow { background-image:url(:/icons/background.png); background-position: center; background-repeat: no-repeat; }" );
16+ menuBar ()->setAutoFillBackground (true );
17+ resize ({1000 , 700 }); // Initial size, overwritten by stored window geometry if present
1518
1619 // Load state and geometry
1720 UserSettings settings;
@@ -21,16 +24,18 @@ ResultWindow::ResultWindow(const QString& filePath, const BowResult& data) {
2124 // Try to load output data
2225 try {
2326 this ->data = data;
24- this -> setCentralWidget (new OutputWidget (this ->data ));
27+ setCentralWidget (new OutputWidget (this ->data ));
2528 }
2629 catch (const std::exception& e) {
2730 QMessageBox::critical (this , " Error" , " Failed to open result data:\n " + QString (e.what ()));
2831 }
2932}
3033
31- void ResultWindow::closeEvent (QCloseEvent * event) {
34+ void ResultWindow::closeEvent (QCloseEvent* event) {
3235 // Save state and geometry
3336 UserSettings settings;
3437 settings.setValue (" OutputWindow/state" , saveState ());
3538 settings.setValue (" OutputWindow/geometry" , saveGeometry ());
39+
40+ event->accept ();
3641}
0 commit comments