gui
Loading...
Searching...
No Matches
rightContent.cc
Go to the documentation of this file.
1// gui
2#include "gui.h"
3
4// gemc
5#include "g4display.h"
7#include "g4dialog.h"
8#include "dbselectView.h"
9#include "gtree.h"
10#include "pmakerView.h"
11#include "gemc/actions/gaction.h"
12
13// geant4
14#include "G4RunManager.hh"
15
16void GemcGUI::createRightContent(std::shared_ptr<GOptions> gopts,
18 GBoard* gb) {
19 // The stacked widget hosts all right-side pages. The left button bar selects the current index.
20 rightContent = new QStackedWidget;
21
22
23
24 // Page order must match the left button bar order so indexes remain consistent.
25 auto* setupView = new DBSelectView(gopts, dc);
26
27 // display controls
28 auto* g4display = new G4Display(gopts);
29 rightContent->addWidget(g4display);
30 auto* displayUtilities = g4display->findChild<G4DisplayUtilities*>();
31 if (displayUtilities) {
32 connect(displayUtilities, &G4DisplayUtilities::sceneOptionsChanged,
33 this, &GemcGUI::refreshVisualizationFromOptions);
34 }
35
36 // setup/systems controls
37 rightContent->addWidget(setupView);
38 connect(setupView, &DBSelectView::geometryAboutToReload, this, &GemcGUI::resetVisualizationBeforeGeometryReload);
39 connect(setupView, &DBSelectView::geometryReloaded, this, &GemcGUI::refreshGeometryTree);
40
41 // gvolume controls
42 geometryTree = new GTree(gopts,
43 dc && dc->has_built_geometry()
44 ? dc->get_g4volumes_map()
45 : std::unordered_map<std::string, G4Volume*>{},
46 dc && dc->has_built_geometry()
48 : std::unordered_map<std::string, const GVolume*>{});
49 rightContent->addWidget(geometryTree);
50
51 // g4dialog
52 rightContent->addWidget(new G4Dialog(gopts, gb));
53
54 // generator / particle maker — share the exact same GparticlePtr objects as the generator
55 std::shared_ptr<std::vector<GparticlePtr>> sharedParticles;
56 if (auto* rm = G4RunManager::GetRunManager()) {
57 if (auto* ga = dynamic_cast<GAction*>(
58 const_cast<G4VUserActionInitialization*>(rm->GetUserActionInitialization())))
59 sharedParticles = ga->getSharedParticles();
60 }
61 rightContent->addWidget(new PmakerView(sharedParticles, gopts));
62
63 // Default to the first page and update the left bar visual highlight accordingly.
64 rightContent->setCurrentIndex(0);
65 leftButtons->press_button(0);
66}
void geometryReloaded()
void geometryAboutToReload()
void sceneOptionsChanged()
std::unordered_map< std::string, const GVolume * > get_gvolumes_flat_map() const
std::unordered_map< std::string, G4Volume * > get_g4volumes_map() const
bool has_built_geometry() const
void press_button(int i)