Skip to main content

DataFocusAware

DataFocusAware

Mixin interface for widgets that respond to data focus changes. More…

#include <DataFocusAware.hpp>

Inherited by DataImport_Widget, DataTransform_Widget, MLCoreWidget, TransformsV2Properties_Widget

Public Functions

Name
virtual ~DataFocusAware() =default
virtual void onDataFocusChanged(EditorLib::SelectedDataKey const & data_key, QString const & data_type) =0
Called when data focus changes.

Protected Functions

Name
template <typename Receiver >
void
connectToSelectionContext(SelectionContext * ctx, Receiver * receiver)
Helper to connect this widget to SelectionContext.

Detailed Description

class DataFocusAware;

Mixin interface for widgets that respond to data focus changes.

This is a pure interface class (no data members, only virtual methods). Implementations should:

  1. Call connectToSelectionContext() in constructor
  2. Implement onDataFocusChanged() to handle focus updates

Public Functions Documentation

function ~DataFocusAware

virtual ~DataFocusAware() =default

function onDataFocusChanged

virtual void onDataFocusChanged(
    EditorLib::SelectedDataKey const & data_key,
    QString const & data_type
) =0

Called when data focus changes.

Parameters:

  • data_key The newly focused data key (may be invalid if nothing focused)
  • data_type The type of the focused data (e.g., “LineData”, “MaskData”)

Reimplemented by: DataImport_Widget::onDataFocusChanged, DataTransform_Widget::onDataFocusChanged, MLCoreWidget::onDataFocusChanged, TransformsV2Properties_Widget::onDataFocusChanged

Implementations should:

  1. Update internal model/state
  2. Refresh UI if currently visible
  3. NOT raise themselves to front (user controls tab visibility)

Protected Functions Documentation

function connectToSelectionContext

template <typename Receiver >
inline void connectToSelectionContext(
    SelectionContext * ctx,
    Receiver * receiver
)

Helper to connect this widget to SelectionContext.

Parameters:

  • ctx The SelectionContext to observe
  • receiver The QObject that will receive the signal (typically ‘this’)

Call this in your widget’s constructor after initializing the SelectionContext pointer.

Example: ```cpp

MyWidget::MyWidget(SelectionContext * ctx, QWidget * parent) : QWidget(parent), _ctx(ctx) { connectToSelectionContext(ctx, this); } ```


Updated on 2026-11-13 at 20:25:41 +0000