Skip to main content

DataViewer::DataViewerInteractionManager

DataViewer::DataViewerInteractionManager

Manages interaction state machine for creating and modifying glyphs.

#include <DataViewerInteractionManager.hpp>

Inherits from QObject

Public Signals

Name
void modeChanged(DataViewer::InteractionMode mode)
Emitted when the interaction mode changes.
void interactionCompleted(CorePlotting::Interaction::DataCoordinates const & coords)
Emitted when an interaction completes successfully.
void previewUpdated()
Emitted when the preview geometry changes.
void cursorChangeRequested(Qt::CursorShape cursor)
Emitted when cursor shape should change.

Public Functions

Name
DataViewerInteractionManager(QObject * parent =[nullptr])
~DataViewerInteractionManager() override =default
void setContext(InteractionContext const & ctx)
Update the context used for coordinate conversions.
void setMode(InteractionMode mode)
Set the current interaction mode.
InteractionMode mode() const
Get the current interaction mode.
bool isActive() const
Check if any interaction is currently active.
void cancel()
Cancel any active interaction without committing.
void startIntervalCreation(std::string const & series_key, float canvas_x, float canvas_y, glm::vec4 const & fill_color, glm::vec4 const & stroke_color)
Start creating a new interval.
void startEdgeDrag(CorePlotting::HitTestResult const & hit_result, glm::vec4 const & fill_color, glm::vec4 const & stroke_color)
Start dragging an interval edge.
void update(float canvas_x, float canvas_y)
Update the current interaction with new mouse position.
void complete()
Complete the current interaction.
std::optional< CorePlotting::Interaction::GlyphPreview > getPreview() const
Get the current preview geometry for rendering.

Public Signals Documentation

signal modeChanged

void modeChanged(
    DataViewer::InteractionMode mode
)

Emitted when the interaction mode changes.

signal interactionCompleted

void interactionCompleted(
    CorePlotting::Interaction::DataCoordinates const & coords
)

Emitted when an interaction completes successfully.

The DataCoordinates contain all information needed to update the DataManager.

signal previewUpdated

void previewUpdated()

Emitted when the preview geometry changes.

signal cursorChangeRequested

void cursorChangeRequested(
    Qt::CursorShape cursor
)

Emitted when cursor shape should change.

Public Functions Documentation

function DataViewerInteractionManager

explicit DataViewerInteractionManager(
    QObject * parent =nullptr
)

function ~DataViewerInteractionManager

~DataViewerInteractionManager() override =default

function setContext

void setContext(
    InteractionContext const & ctx
)

Update the context used for coordinate conversions.

function setMode

void setMode(
    InteractionMode mode
)

Set the current interaction mode.

Changes how mouse events are interpreted. When switching modes, any active interaction is cancelled.

function mode

inline InteractionMode mode() const

Get the current interaction mode.

function isActive

bool isActive() const

Check if any interaction is currently active.

function cancel

void cancel()

Cancel any active interaction without committing.

function startIntervalCreation

void startIntervalCreation(
    std::string const & series_key,
    float canvas_x,
    float canvas_y,
    glm::vec4 const & fill_color,
    glm::vec4 const & stroke_color
)

Start creating a new interval.

Parameters:

  • series_key The key identifying the target series
  • canvas_x Starting X position in canvas coordinates
  • canvas_y Starting Y position in canvas coordinates
  • fill_color Fill color for the preview
  • stroke_color Stroke color for the preview

function startEdgeDrag

void startEdgeDrag(
    CorePlotting::HitTestResult const & hit_result,
    glm::vec4 const & fill_color,
    glm::vec4 const & stroke_color
)

Start dragging an interval edge.

Parameters:

  • hit_result The hit test result identifying the edge
  • fill_color Fill color for the preview
  • stroke_color Stroke color for the preview

function update

void update(
    float canvas_x,
    float canvas_y
)

Update the current interaction with new mouse position.

Parameters:

  • canvas_x Current X position in canvas coordinates
  • canvas_y Current Y position in canvas coordinates

function complete

void complete()

Complete the current interaction.

Converts preview geometry to data coordinates and emits interactionCompleted signal.

function getPreview

std::optional< CorePlotting::Interaction::GlyphPreview > getPreview() const

Get the current preview geometry for rendering.

Return: Preview if an interaction is active, nullopt otherwise


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