g4display
g4display.cc
Go to the documentation of this file.
1 // gemc
2 #include "g4display.h" // Class definition
3 #include "g4display_options.h" // Provides G4DISPLAY_LOGGER constant and option definitions
4 #include "tabs/g4displayview.h" // View control tab
5 #include "tabs/g4displayutilities.h" // Utilities tab
6 
7 // G4Display Constructor
8 // Initializes the QTabWidget base class and the unique_ptr for the logger.
9 // Creates and adds the specific control tabs.
10 G4Display::G4Display(GOptions* gopt, QWidget* parent) :
11  QWidget(parent), log(std::make_shared<GLogger>(gopt, G4DISPLAY_LOGGER))
12 {
13  // Log the construction event using the newly created logger.
14  // Use level 0 info for general construction messages.
15  log->debug(CONSTRUCTOR, "G4Display");
16 
17  auto dialogTabs = new QTabWidget;
18 
19  // Create and add the 'View' tab.
20  // Pass the GOptions, the logger instance (retrieved via log.get()), and this widget as the parent.
21  dialogTabs->addTab(new G4DisplayView(gopt, log, this), tr("View"));
22 
23  // Create and add the 'Utilities' tab.
24  // Pass the GOptions, the logger instance, and this widget as the parent.
25  dialogTabs->addTab(new G4DisplayUtilities(gopt, log, this), tr("Utilities"));
26 
27  QVBoxLayout *mainLayout = new QVBoxLayout;
28  mainLayout->addWidget(dialogTabs);
29  setLayout(mainLayout);
30 
31  // Optional: Log successful initialization
32  log->debug(NORMAL, "View and Utilities tabs added.");
33 }
34 
35 // G4Display Destructor
36 // The unique_ptr 'log' will automatically delete the GLogger instance here.
38  log->debug(DESTRUCTOR, "G4Display");
39 }
A utility widget for Geant4 display functionalities.
A QWidget tab providing controls for Geant4 camera, lighting, slicing, and view styles.
Definition: g4displayview.h:28
~G4Display() override
Destructor. Manages the lifetime of owned resources (like the logger).
Definition: g4display.cc:37
G4Display(GOptions *gopt, QWidget *parent=nullptr)
Constructs the G4Display widget.
Definition: g4display.cc:10
constexpr const char * G4DISPLAY_LOGGER