dbselect
Loading...
Searching...
No Matches
DBSelectView Class Reference

Qt widget used to select experiment/system configurations from an SQLite geometry database. More...

#include <dbselectView.h>

Public Slots

void reload_geometry ()
 Slot invoked by the Reload button to reload geometry based on current selections.
 

Public Member Functions

 DBSelectView (const std::shared_ptr< GOptions > &gopts, GDetectorConstruction *dc, QWidget *parent=nullptr)
 Construct the view and populate the experiment/system model from the database.
 
 ~DBSelectView () override
 Destructor.
 
SystemList get_gsystems ()
 Build and return the list of selected systems as a SystemList.
 
- Public Member Functions inherited from GBase< DBSelectView >
 GBase (const std::shared_ptr< GOptions > &gopt, std::string logger_name="")
 
 GBase (const std::shared_ptr< GLogger > &logger)
 
 GBase (const GBase &)=default
 
 GBase (GBase &&) noexcept=default
 
virtual ~GBase ()
 
GBaseoperator= (const GBase &)=default
 
GBaseoperator= (GBase &&) noexcept=default
 

Additional Inherited Members

- Protected Attributes inherited from GBase< DBSelectView >
std::shared_ptr< GLoggerlog
 

Detailed Description

DBSelectView displays a tree of experiments and their systems obtained from an SQLite database. Each system row allows:

  • enabling/disabling the system via a checkbox,
  • selecting a variation from a drop-down list,
  • selecting a run number from a drop-down list,
  • viewing the number of matching geometry entries for the current selection,
  • seeing an availability indicator (green/red icon) driven by database counts.

The widget is designed to be used as a selection front-end for geometry reload:

Ownership model:

  • The widget owns its Qt child widgets through Qt parent-child relationships.
  • The widget owns and closes the sqlite3 database handle opened read-only.
  • The widget does not own the provided GDetectorConstruction pointer.

Important Qt note: GBase must appear after QWidget derivations; otherwise Qt's MOC expects a staticMetaObject.

Definition at line 47 of file dbselectView.h.

Constructor & Destructor Documentation

◆ DBSelectView()

DBSelectView::DBSelectView ( const std::shared_ptr< GOptions > & gopts,
GDetectorConstruction * dc,
QWidget * parent = nullptr )
explicit

Construction steps (high-level):

  • Read the database location and default experiment from options.
  • Resolve the database path via a search in common locations and open it read-only.
  • Validate that the database contains a non-empty geometry table.
  • Create the UI, populate the model, and apply existing GSystem selections.
Parameters
goptsShared options used for database selection, default experiment, and UI mode.
dcDetector construction instance used to reload geometry on user request.
parentOptional parent widget for Qt ownership.

Definition at line 19 of file dbselectView.cc.

◆ ~DBSelectView()

DBSelectView::~DBSelectView ( )
inlineoverride

Closes the sqlite3 handle if it was successfully opened. Qt child widgets are cleaned up automatically by Qt parent ownership.

Definition at line 73 of file dbselectView.h.

Member Function Documentation

◆ get_gsystems()

SystemList DBSelectView::get_gsystems ( )

The returned SystemList contains one GSystem for each checked system item in the model. For each enabled system, the selected variation and run are taken from the corresponding model columns.

This function does not change the UI state; it is a pure extraction step.

Returns
A SystemList representing the currently checked systems and their selections.

Definition at line 537 of file dbselectView.cc.

◆ reload_geometry

void DBSelectView::reload_geometry ( )
slot

High-level behavior:

  • Build a SystemList from the model selections.
  • Invoke detector construction reload using that list.
  • Clear the modified state and refresh the UI.

Definition at line 598 of file dbselectView.cc.


The documentation for this class was generated from the following files: