dl::widget::DataSourceComboHelper
dl::widget::DataSourceComboHelper
Manages DataManager-aware QComboBox population and auto-refresh. More…
#include <DataSourceComboHelper.hpp>
Inherits from QObject
Public Functions
| Name | |
|---|---|
| DataSourceComboHelper(std::shared_ptr< DataManager > dm, QObject * parent =[nullptr]) Construct a helper bound to a DataManager. |
|
| ~DataSourceComboHelper() override | |
| DataSourceComboHelper(DataSourceComboHelper const & ) =delete | |
| DataSourceComboHelper & | operator=(DataSourceComboHelper const & ) =delete |
| DataSourceComboHelper(DataSourceComboHelper && ) =delete | |
| DataSourceComboHelper & | operator=(DataSourceComboHelper && ) =delete |
| void | populateCombo(QComboBox * combo, std::vector< DM_DataType > const & types) const Populate a combo with DataManager keys matching the given types. |
| void | populateCombo(QComboBox * combo, DM_DataType type) const Convenience overload to populate from a single data type. |
| void | track(QComboBox * combo, std::vector< DM_DataType > const & types) Register a combo for automatic refresh. |
| void | track(QComboBox * combo, DM_DataType type) Convenience overload to track with a single data type. |
| void | untrack(QComboBox * combo) Stop tracking a combo for auto-refresh. |
| void | refreshAll() Re-populate all tracked combos. |
| int | trackedCount() const Return the number of currently tracked combos. |
| std::vector< DM_DataType > | typesFromHint(std::string const & type_hint) Convert a type-hint string to a vector of DM_DataType values. |
Detailed Description
class dl::widget::DataSourceComboHelper;Manages DataManager-aware QComboBox population and auto-refresh.
Note: Not thread-safe — must only be used from the GUI thread.
Tracks registered combos and the DM_DataType filter each should display. When refreshAll() is called (typically from a DataManager observer), all tracked combos are re-populated while preserving the user’s current selection where possible.
Public Functions Documentation
function DataSourceComboHelper
explicit DataSourceComboHelper(
std::shared_ptr< DataManager > dm,
QObject * parent =nullptr
)Construct a helper bound to a DataManager.
Parameters:
- dm Shared pointer to the DataManager to query for keys.
- parent Optional QObject parent for lifetime management.
Precondition: dm must not be null.
function ~DataSourceComboHelper
~DataSourceComboHelper() overridefunction DataSourceComboHelper
DataSourceComboHelper(
DataSourceComboHelper const &
) =deletefunction operator=
DataSourceComboHelper & operator=(
DataSourceComboHelper const &
) =deletefunction DataSourceComboHelper
DataSourceComboHelper(
DataSourceComboHelper &&
) =deletefunction operator=
DataSourceComboHelper & operator=(
DataSourceComboHelper &&
) =deletefunction populateCombo
void populateCombo(
QComboBox * combo,
std::vector< DM_DataType > const & types
) constPopulate a combo with DataManager keys matching the given types.
Parameters:
- combo The combo box to populate.
- types Data types to include. An empty vector means all keys.
Precondition: combo must not be null.
Clears the combo, adds a “(None)” sentinel, then appends all matching keys. If the combo previously had a valid selection, it is restored.
function populateCombo
void populateCombo(
QComboBox * combo,
DM_DataType type
) constConvenience overload to populate from a single data type.
function track
void track(
QComboBox * combo,
std::vector< DM_DataType > const & types
)Register a combo for automatic refresh.
Parameters:
- combo The combo box to track.
- types Data types to include on refresh. Empty = all keys.
Precondition: combo must not be null.
The combo will be re-populated with the given type filter whenever refreshAll() is called. If the combo is destroyed before being untracked, it is automatically removed.
function track
void track(
QComboBox * combo,
DM_DataType type
)Convenience overload to track with a single data type.
function untrack
void untrack(
QComboBox * combo
)Stop tracking a combo for auto-refresh.
Safe to call even if the combo was never tracked or already untracked.
function refreshAll
void refreshAll()Re-populate all tracked combos.
Typically connected to a DataManager observer callback.
function trackedCount
int trackedCount() constReturn the number of currently tracked combos.
function typesFromHint
static std::vector< DM_DataType > typesFromHint(
std::string const & type_hint
)Convert a type-hint string to a vector of DM_DataType values.
Maps known strings: “MediaData” → {Video, Images}, “PointData” → {Points}, “MaskData” → {Mask}, “LineData” → {Line}, “AnalogTimeSeries” → {Analog}, “TensorData” → {Tensor}.
Returns an empty vector for unrecognized strings (meaning “all keys”).
Updated on 2026-11-13 at 20:25:42 +0000