move redundant code to find pointer to main widget to helper function
This commit is contained in:
@ -13,6 +13,7 @@
|
||||
|
||||
#include "imageviewer.h"
|
||||
|
||||
#include "helpers.h"
|
||||
#include "lammpsgui.h"
|
||||
#include "lammpswrapper.h"
|
||||
|
||||
@ -769,9 +770,7 @@ void ImageViewer::copy() {}
|
||||
|
||||
void ImageViewer::quit()
|
||||
{
|
||||
LammpsGui *main = nullptr;
|
||||
for (QWidget *widget : QApplication::topLevelWidgets())
|
||||
if (widget->objectName() == "LammpsGui") main = dynamic_cast<LammpsGui *>(widget);
|
||||
auto *main = dynamic_cast<LammpsGui *>(get_main_widget());
|
||||
if (main) main->quit();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user