NDEVR
API Documentation

A dialog which can be used to set various units for different unit categories, such as selecting the various properties by which to show angles. More...

Collaboration diagram for UnitsDialog:
[legend]

Public Member Functions

 UnitsDialog (QWidget *parent=nullptr)
 Constructs a UnitsDialog with an optional parent.
 UnitsDialog (UnitManager *manager, QWidget *parent=nullptr)
 Constructs a UnitsDialog bound to a specific UnitManager.
void edited ()
 Signal emitted when any unit selection has been edited.
void hideAngleUnit ()
 Hides the angle unit selection section.
void hideCoordinateMode ()
 Hides the coordinate mode selection section.
void hideDefaultButtons ()
 Hides the default/reset buttons from the dialog.
void hideSpacialLabels ()
 Hides the spatial dimension labels in the dialog.
void hideSurfaceVolumeUnit ()
 Hides the surface area and volume unit selection sections.
void refreshUnitsDialog ()
 Refreshes all combo box contents to reflect current unit options.
void removeScrollArea ()
 Removes the scroll area wrapper from the dialog layout.
void resetToDefaultUnits ()
 Resets all unit selections to their default values.
void setAllowSubUnit (bool allow_sub_unit)
 Enables or disables the sub-unit selection combo boxes.
void setAutosize (bool auto_size)
 Enables or disables automatic resizing of the dialog.
void setManager (UnitManager *manager)
 Sets the UnitManager that this dialog configures.

Protected Member Functions

bool event (QEvent *event) override
 Handles events, including language-change retranslation.
QWidget * extraUnitWidget (DynamicPointer< CustomUnit > custom_unit)
 Creates an additional widget for editing a custom unit.
void initialize ()
 Performs one-time initialization of the dialog layout and connections.
void retranslate ()
 Retranslates all user-facing text in the dialog.
ConstPointer< UnitselectedUnit (const Buffer< ConstPointer< UnitOption > > &options, const ConstPointer< Unit > &reference_unit, QCustomComboBox *combo, QCustomComboBox *subcombo=nullptr)
 Returns the unit selected from a list of options.
ConstPointer< UnitselectedUnit (UnitCategory type, QCustomComboBox *combo, QCustomComboBox *subcombo=nullptr)
 Returns the unit currently selected in the combo for a given category.
void setSelectedUnit (UnitCategory type, QCustomComboBox *combo, QCustomComboBox *subcombo=nullptr)
 Applies the selected unit for a given category to the UnitManager.
void setup ()
 Configures the dialog layout and combo box connections.
ConstPointer< UnitOptionsetupCombo (const Buffer< ConstPointer< UnitOption > > &options, const ConstPointer< Unit > &unit, QCustomComboBox *combo)
 Sets up a combo box and returns the selected unit option.
void setupCombo (const Buffer< ConstPointer< UnitOption > > &options, const ConstPointer< Unit > &unit, QCustomComboBox *combo, QCustomComboBox *subcombo)
 Sets up a combo box with specific unit options and a reference unit.
void setupCombo (UnitCategory type, QCustomComboBox *combo, QCustomComboBox *subcombo=nullptr)
 Sets up a combo box for the given unit category.
void updateComboContents ()
 Updates all combo box contents based on the current UnitManager state.
void updateFromUnit ()
 Updates the UI to reflect the current UnitManager state.
void updateOrientationUnitFromUISlot ()
 Slot that applies the orientation unit selection from the UI to the UnitManager.
void updateSpacialUnitFromUISlot ()
 Slot that applies the spatial unit selection from the UI to the UnitManager.
void updateSurfaceAreaUnitFromUISlot ()
 Slot that applies the surface area unit selection from the UI to the UnitManager.
void updateVolumeUnitFromUISlot ()
 Slot that applies the volume unit selection from the UI to the UnitManager.
void updateWeightUnitFromUISlot ()
 Slot that applies the weight unit selection from the UI to the UnitManager.

Protected Attributes

bool m_allow_sub_unit
 Whether sub-unit combo boxes are enabled.
UnitManagerm_manager
 The UnitManager this dialog configures.
QTResourceListenerm_resource_listener
 Listener for unit resource changes.
bool m_update_posted = false
 Guard to prevent recursive UI updates.
Ui::UnitsDialogUI * ui
 The auto-generated UI form pointer.

Detailed Description

A dialog which can be used to set various units for different unit categories, such as selecting the various properties by which to show angles.


Definition at line 53 of file UnitsDialog.h.

Constructor & Destructor Documentation

◆ UnitsDialog() [1/2]

UnitsDialog::UnitsDialog ( QWidget * parent = nullptr)

Constructs a UnitsDialog with an optional parent.

Parameters
[in]parentThe optional parent widget.

◆ UnitsDialog() [2/2]

UnitsDialog::UnitsDialog ( UnitManager * manager,
QWidget * parent = nullptr )

Constructs a UnitsDialog bound to a specific UnitManager.

Parameters
[in]managerThe UnitManager to configure.
[in]parentThe optional parent widget.

Member Function Documentation

◆ extraUnitWidget()

QWidget * UnitsDialog::extraUnitWidget ( DynamicPointer< CustomUnit > custom_unit)
protected

Creates an additional widget for editing a custom unit.

Parameters
[in]custom_unitThe custom unit to create a widget for.
Returns
A widget for editing the custom unit.

◆ selectedUnit() [1/2]

ConstPointer< Unit > UnitsDialog::selectedUnit ( const Buffer< ConstPointer< UnitOption > > & options,
const ConstPointer< Unit > & reference_unit,
QCustomComboBox * combo,
QCustomComboBox * subcombo = nullptr )
protected

Returns the unit selected from a list of options.

Parameters
[in]optionsThe available unit options.
[in]reference_unitThe reference unit to match against.
[in]comboThe primary combo box.
[in]subcomboThe optional sub-unit combo box.
Returns
The selected Unit.

◆ selectedUnit() [2/2]

ConstPointer< Unit > UnitsDialog::selectedUnit ( UnitCategory type,
QCustomComboBox * combo,
QCustomComboBox * subcombo = nullptr )
protected

Returns the unit currently selected in the combo for a given category.

Parameters
[in]typeThe unit category.
[in]comboThe primary combo box.
[in]subcomboThe optional sub-unit combo box.
Returns
The selected Unit.

◆ setAllowSubUnit()

void UnitsDialog::setAllowSubUnit ( bool allow_sub_unit)

Enables or disables the sub-unit selection combo boxes.

Parameters
[in]allow_sub_unitWhether to allow sub-unit selection.

◆ setAutosize()

void UnitsDialog::setAutosize ( bool auto_size)

Enables or disables automatic resizing of the dialog.

Parameters
[in]auto_sizeWhether to auto-size the dialog.

◆ setManager()

void UnitsDialog::setManager ( UnitManager * manager)

Sets the UnitManager that this dialog configures.

Parameters
[in]managerThe UnitManager to bind to.

◆ setSelectedUnit()

void UnitsDialog::setSelectedUnit ( UnitCategory type,
QCustomComboBox * combo,
QCustomComboBox * subcombo = nullptr )
protected

Applies the selected unit for a given category to the UnitManager.

Parameters
[in]typeThe unit category.
[in]comboThe primary combo box.
[in]subcomboThe optional sub-unit combo box.

◆ setupCombo() [1/3]

ConstPointer< UnitOption > UnitsDialog::setupCombo ( const Buffer< ConstPointer< UnitOption > > & options,
const ConstPointer< Unit > & unit,
QCustomComboBox * combo )
protected

Sets up a combo box and returns the selected unit option.

Parameters
[in]optionsThe available unit options.
[in]unitThe currently selected unit.
[in]comboThe combo box widget.
Returns
The currently selected UnitOption.

◆ setupCombo() [2/3]

void UnitsDialog::setupCombo ( const Buffer< ConstPointer< UnitOption > > & options,
const ConstPointer< Unit > & unit,
QCustomComboBox * combo,
QCustomComboBox * subcombo )
protected

Sets up a combo box with specific unit options and a reference unit.

Parameters
[in]optionsThe available unit options.
[in]unitThe currently selected unit.
[in]comboThe primary combo box widget.
[in]subcomboThe sub-unit combo box widget.

◆ setupCombo() [3/3]

void UnitsDialog::setupCombo ( UnitCategory type,
QCustomComboBox * combo,
QCustomComboBox * subcombo = nullptr )
protected

Sets up a combo box for the given unit category.

Parameters
[in]typeThe unit category to configure.
[in]comboThe primary combo box widget.
[in]subcomboThe optional sub-unit combo box widget.

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