Skip to main content

DataViewer::DataViewerTooltipController

DataViewer::DataViewerTooltipController

Manages tooltip display for the DataViewer widget. More…

#include <DataViewerTooltipController.hpp>

Inherits from QObject

Public Types

Name
using std::function< std::optional< SeriesInfo >(float canvas_x, float canvas_y)> SeriesInfoProvider
Callback type for finding series at a position.

Public Signals

Name
void tooltipShowing(QPoint const & pos, SeriesInfo const & info)
Emitted when a tooltip is about to be shown.
void tooltipHidden()
Emitted when the tooltip is hidden.

Public Functions

Name
DataViewerTooltipController(QWidget * parent_widget)
Construct a tooltip controller.
~DataViewerTooltipController() override =default
void setDelay(int delay_ms)
Set the delay before showing tooltips.
int delay() const
Get the current tooltip delay.
void scheduleTooltip(QPoint const & canvas_pos)
Schedule a tooltip to appear at the given position.
void cancel()
Cancel any pending tooltip.
bool isScheduled() const
Check if a tooltip is currently scheduled (timer running).
void setSeriesInfoProvider(SeriesInfoProvider provider)
Set the callback used to look up series information.

Detailed Description

class DataViewer::DataViewerTooltipController;

Manages tooltip display for the DataViewer widget.

Handles the timing and display of tooltips when hovering over series. Uses callbacks to look up series information without tight coupling to the widget’s data structures.

Public Types Documentation

using SeriesInfoProvider

using DataViewer::DataViewerTooltipController::SeriesInfoProvider =  std::function<std::optional<SeriesInfo>(float canvas_x, float canvas_y)>;

Callback type for finding series at a position.

The callback receives canvas coordinates and returns optional SeriesInfo describing the series (if any) at that position.

Public Signals Documentation

signal tooltipShowing

void tooltipShowing(
    QPoint const & pos,
    SeriesInfo const & info
)

Emitted when a tooltip is about to be shown.

Parameters:

  • pos Canvas position where tooltip will appear
  • info The series information that will be displayed

signal tooltipHidden

void tooltipHidden()

Emitted when the tooltip is hidden.

Public Functions Documentation

function DataViewerTooltipController

explicit DataViewerTooltipController(
    QWidget * parent_widget
)

Construct a tooltip controller.

Parameters:

  • parent_widget The widget to display tooltips on (used for coordinate mapping)

function ~DataViewerTooltipController

~DataViewerTooltipController() override =default

function setDelay

void setDelay(
    int delay_ms
)

Set the delay before showing tooltips.

Parameters:

  • delay_ms Delay in milliseconds (default is 1000ms)

function delay

int delay() const

Get the current tooltip delay.

Return: Delay in milliseconds

function scheduleTooltip

void scheduleTooltip(
    QPoint const & canvas_pos
)

Schedule a tooltip to appear at the given position.

Parameters:

  • canvas_pos Position in canvas coordinates where hover occurred

Starts the hover timer. If the timer completes before cancel() is called, the tooltip will be displayed. If scheduleTooltip is called again before the timer completes, the timer restarts with the new position.

function cancel

void cancel()

Cancel any pending tooltip.

Stops the hover timer and hides any visible tooltip.

function isScheduled

bool isScheduled() const

Check if a tooltip is currently scheduled (timer running).

Return: true if waiting to show a tooltip

function setSeriesInfoProvider

void setSeriesInfoProvider(
    SeriesInfoProvider provider
)

Set the callback used to look up series information.

Parameters:

  • provider Function that returns SeriesInfo for a canvas position

This callback is invoked when the tooltip timer fires to determine what information to display.


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