diff options
author | Louie S <louie@example.com> | 2024-07-23 20:37:48 -0400 |
---|---|---|
committer | Louie S <louie@example.com> | 2024-07-23 20:37:48 -0400 |
commit | c34930425fadfc4083067b9306159cd8e8ecf6c6 (patch) | |
tree | d9c09709f1b9cf7e9bcf098d48c7036044098a7d /src/frontend/qtwidgets/lib.cpp | |
parent | f820f439910ef0243e6b9aded293190341b058ac (diff) |
Rearrange source file locations
Diffstat (limited to 'src/frontend/qtwidgets/lib.cpp')
-rw-r--r-- | src/frontend/qtwidgets/lib.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/frontend/qtwidgets/lib.cpp b/src/frontend/qtwidgets/lib.cpp new file mode 100644 index 0000000..2290472 --- /dev/null +++ b/src/frontend/qtwidgets/lib.cpp @@ -0,0 +1,22 @@ +#include <QApplication> +#include <QMainWindow> +#include <QWidget> + +#include "lib.h" + +// shamelessly ripped from https://stackoverflow.com/a/46456214 +AssignmentList *getMainWindow() { + foreach(QWidget *w, QApplication::topLevelWidgets()) + if(AssignmentList *mainWin = qobject_cast<AssignmentList*>(w)) + return mainWin; + return nullptr; +} + +void recursiveClear(QLayout *layout) { + QLayoutItem *child; + while((child = layout->takeAt(0)) != nullptr) { + if(child->layout()) recursiveClear(child->layout()); + delete child->widget(); + delete child; + } +} |