Skip to main content

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() override

function DataSourceComboHelper

DataSourceComboHelper(
    DataSourceComboHelper const & 
) =delete

function operator=

DataSourceComboHelper & operator=(
    DataSourceComboHelper const & 
) =delete

function DataSourceComboHelper

DataSourceComboHelper(
    DataSourceComboHelper && 
) =delete

function operator=

DataSourceComboHelper & operator=(
    DataSourceComboHelper && 
) =delete

function populateCombo

void populateCombo(
    QComboBox * combo,
    std::vector< DM_DataType > const & types
) const

Populate 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
) const

Convenience 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() const

Return 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