34#include <NDEVR/Unit.h>
35#include <NDEVR/Pointer.h>
160 Ui::UnitsDialogUI*
ui;
The equivelent of std::vector but with a bit more control.
Provides a constant, unmodifiable pointer that has shared ownership of a dynamically allocated object...
A program-defined unit that can be used for some specific task different from a program-wide unit.
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
A compact way to present a list of options to the user.
A ResourceListener which will always be executed on the main UI thread and can be tied to a Qt Object...
Manages a collection of units across multiple data categories with INI persistence.
A definition of how to describe a particular set of data to a custom category of unit.
ConstPointer< Unit > selectedUnit(const Buffer< ConstPointer< UnitOption > > &options, const ConstPointer< Unit > &reference_unit, QCustomComboBox *combo, QCustomComboBox *subcombo=nullptr)
Returns the unit selected from a list of options.
void hideSurfaceVolumeUnit()
Hides the surface area and volume unit selection sections.
void initialize()
Performs one-time initialization of the dialog layout and connections.
bool m_update_posted
Guard to prevent recursive UI updates.
void removeScrollArea()
Removes the scroll area wrapper from the dialog layout.
QTResourceListener * m_resource_listener
Listener for unit resource changes.
void setAutosize(bool auto_size)
Enables or disables automatic resizing of the dialog.
void updateOrientationUnitFromUISlot()
Slot that applies the orientation unit selection from the UI to the UnitManager.
bool m_allow_sub_unit
Whether sub-unit combo boxes are enabled.
ConstPointer< Unit > selectedUnit(UnitCategory type, QCustomComboBox *combo, QCustomComboBox *subcombo=nullptr)
Returns the unit currently selected in the combo for a given category.
QWidget * extraUnitWidget(DynamicPointer< CustomUnit > custom_unit)
Creates an additional widget for editing a custom unit.
Ui::UnitsDialogUI * ui
The auto-generated UI form pointer.
bool event(QEvent *event) override
Handles events, including language-change retranslation.
void updateSurfaceAreaUnitFromUISlot()
Slot that applies the surface area unit selection from the UI to the UnitManager.
void hideAngleUnit()
Hides the angle unit selection section.
UnitManager * m_manager
The UnitManager this dialog configures.
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 setAllowSubUnit(bool allow_sub_unit)
Enables or disables the sub-unit selection combo boxes.
void resetToDefaultUnits()
Resets all unit selections to their default values.
ConstPointer< UnitOption > setupCombo(const Buffer< ConstPointer< UnitOption > > &options, const ConstPointer< Unit > &unit, QCustomComboBox *combo)
Sets up a combo box and returns the selected unit option.
void setup()
Configures the dialog layout and combo box connections.
UnitsDialog(QWidget *parent=nullptr)
Constructs a UnitsDialog with an optional parent.
void setManager(UnitManager *manager)
Sets the UnitManager that this dialog configures.
void hideDefaultButtons()
Hides the default/reset buttons from the dialog.
void refreshUnitsDialog()
Refreshes all combo box contents to reflect current unit options.
void edited()
Signal emitted when any unit selection has been edited.
void retranslate()
Retranslates all user-facing text in the dialog.
void updateComboContents()
Updates all combo box contents based on the current UnitManager state.
UnitsDialog(UnitManager *manager, QWidget *parent=nullptr)
Constructs a UnitsDialog bound to a specific UnitManager.
void updateWeightUnitFromUISlot()
Slot that applies the weight unit selection from the UI to the UnitManager.
void hideSpacialLabels()
Hides the spatial dimension labels in the dialog.
void setupCombo(UnitCategory type, QCustomComboBox *combo, QCustomComboBox *subcombo=nullptr)
Sets up a combo box for the given unit category.
void setSelectedUnit(UnitCategory type, QCustomComboBox *combo, QCustomComboBox *subcombo=nullptr)
Applies the selected unit for a given category to the UnitManager.
void updateFromUnit()
Updates the UI to reflect the current UnitManager state.
void updateSpacialUnitFromUISlot()
Slot that applies the spatial unit selection from the UI to the UnitManager.
void hideCoordinateMode()
Hides the coordinate mode selection section.
void updateVolumeUnitFromUISlot()
Slot that applies the volume unit selection from the UI to the UnitManager.
The primary namespace for the NDEVR SDK.
UnitCategory
A category of unit describing what it relates to.