g4dialog
Loading...
Searching...
No Matches
g4dialog.cc
Go to the documentation of this file.
1// G4Dialog
2#include "g4dialog.h"
3#include "g4dialog_options.h" // Provides G4DIALOG_LOGGER constant and option definitions
4#include "tabs/gcommands.h"
5#include "gui_session.h"
6
7// geant4
8#include "G4UImanager.hh"
9
10
11G4Dialog::G4Dialog(const std::shared_ptr<GOptions>& gopt, QWidget* parent) :
12 GBase(gopt, G4DIALOG_LOGGER),
13 QWidget(parent) {
14 auto dialogTabs = new QTabWidget;
15
16 gboard = new GBoard(gopt, this);
17 auto UIM = G4UImanager::GetUIpointer();
18
19 gui_session = std::make_unique<GUI_Session>(gopt, gboard);
20 UIM->SetCoutDestination(gui_session.get());
21
22 dialogTabs->addTab(new G4Commands(this), "Geant4 Commands");
23 dialogTabs->addTab(gboard, "Log");
24
25 auto* mainLayout = new QVBoxLayout;
26 mainLayout->addWidget(dialogTabs);
27 setLayout(mainLayout);
28
29 log->debug(NORMAL, "View and Utilities tabs added.");
30}
31
32
34
35 // Detach G4 cout/cerr from our GUI session (avoid dangling callback)
36 if (auto* UIM = G4UImanager::GetUIpointer()) {
37 // If available in your G4 version, prefer checking current destination:
38 // if (UIM->GetCoutDestination() == gui_session.get()) { ... }
39 UIM->SetCoutDestination(nullptr);
40 }
41
42 // Destroy the session *now*, before member teardown sequence
43 gui_session.reset();
44
45}
G4Dialog(const std::shared_ptr< GOptions > &gopt, QWidget *parent=nullptr)
Definition g4dialog.cc:11
~G4Dialog() override
Definition g4dialog.cc:33
A widget that displays read-only log text along with a top bar for search, clear, and save actions.
Definition gboard.h:17
constexpr const char * G4DIALOG_LOGGER