HwSettingsWidget

HwSettingsWidget is an embeddable QWidget that renders the settings registered in the HardwareRegistry for a specific hardware type and driver. It appears in two places in the hardware workflow:

  • AddProfileDialog (Create mode) — shown when the user creates a new hardware profile. Required settings are presented as editable typed widgets so the user can supply construction-time values before the hardware object is instantiated.

  • HWDialog (Edit mode) — shown when the user opens an existing profile for editing via the Hardware Menu or the Hardware and Library Configuration pages. Required settings are rendered as read-only text rows because they must not change after the hardware object has been constructed.

See the Hardware Profiles page for the full profile creation and editing workflow.

Required / Important / Optional tiers

Settings are organized into three priority tiers driven by the HwSettingPriority values (documented on the HardwareRegistry page) and registered in the HardwareRegistry:

  • Required — construction-time settings that identify the hardware instance (port, address, channel assignment, etc.). Rendered in a QFormLayout at the top of the widget. Editable in Create mode; read-only in Edit mode.

  • Important — settings with sensible defaults that the user should review. Rendered in an always-visible two-column table.

  • Optional — rarely changed settings. Rendered in a collapsible two-column table inside a QGroupBox labeled Advanced Settings in the UI.

Array settings

Settings declared as array types (HwArraySettingDef) appear as a table row showing the current entry count and an Edit button. Pressing the button opens HwArrayEditDialog, which lets the user add, remove, and reorder the array entries. The updated entries are stored in the widget and returned by arrayValues().

Extracting values

After the user closes the parent dialog, the caller retrieves the entered data through two methods:

  • values() — returns all scalar settings as a QHash<QString, QVariant> keyed by SettingsStorage key. In Create mode this covers all tiers; in Edit mode it covers the Important and Optional tiers only (Required settings are read-only).

  • arrayValues() — returns array settings as a QMap<QString, std::vector<SettingsStorage::SettingsMap>>.

In Edit mode the caller can alternatively call saveToStorage(storageKey) to write both scalar and array values directly to SettingsStorage.

API Reference

enum class HwSettingsMode

Display mode for HwSettingsWidget.

  • Create: Required settings are shown as editable typed widgets (for AddProfileDialog, before the hardware object is constructed).

  • Edit: Required settings are shown as read-only text rows (for HWDialog, where Required settings must not change post-creation).

Values:

enumerator Create
enumerator Edit
class HwSettingsWidget : public QWidget

Embeddable widget that renders hardware settings from the HardwareRegistry grouped by priority.

Settings are drawn from the HardwareRegistry for a given hardware type and driver and are presented in three tiers:

  • Required — editable QFormLayout in Create mode; read-only text rows in Edit mode.

  • Important — always-visible two-column table.

  • Optional/Advanced — collapsible two-column table inside a QGroupBox.

Array settings appear as a table row with an inline entry count and an Edit button that opens HwArrayEditDialog.

Public Functions

explicit HwSettingsWidget(const QString &hwType, const QString &impl, HwSettingsMode mode, const QString &storageKey = {}, QWidget *parent = nullptr)

Construct the settings widget.

Parameters:
  • hwType – Hardware type key (e.g., “FtmwDigitizer”)

  • impl – Implementation key (e.g., “VirtualFtmwDigitizer”)

  • mode – Create or Edit mode (controls Required section editability)

  • storageKeySettingsStorage key to pre-populate current values from. Pass an empty string in Create mode to use registry defaults.

  • parent – Parent widget

QHash<QString, QVariant> values() const

Return current scalar values keyed by SettingsStorage key.

In Create mode returns all priority tiers. In Edit mode returns Important and Optional values only (Required are read-only).

QMap<QString, std::vector<SettingsStorage::SettingsMap>> arrayValues() const

Return current array values keyed by array key.

void saveToStorage(const QString &storageKey) const

Write all scalar and array values to SettingsStorage.

Parameters:

storageKey – The SettingsStorage key for the hardware instance.

Private Functions

void populate(const QString &storageKey)
QWidget *makeScalarWidget(const HwSettingDef &def, const QVariant &currentValue)
QVariant readWidget(QWidget *widget, const QVariant &defaultValue) const
void addArrayTableRow(SettingsTable *table, const HwArraySettingDef &def)
QStringList subKeysForArray(const HwArraySettingDef &def) const

Private Members

QString d_hwType
QString d_impl
HwSettingsMode d_mode
QTabWidget *p_tabWidget = {nullptr}
QLabel *p_noSettingsLabel = {nullptr}
QFormLayout *p_requiredLayout = {nullptr}
QGroupBox *p_requiredGroup = {nullptr}
SettingsTable *p_importantTable = {nullptr}
QGroupBox *p_importantGroup = {nullptr}
SettingsTable *p_advancedTable = {nullptr}
QHash<QString, QWidget*> d_scalarWidgets
QMap<QString, std::vector<SettingsStorage::SettingsMap>> d_arrayValues