Skip to main content

RelativeTimeAxisWidget

RelativeTimeAxisWidget

Widget that renders a horizontal time axis for relative time plots. More…

#include <RelativeTimeAxisWidget.hpp>

Inherits from QWidget

Public Types

Name
using std::function< CorePlotting::ViewState()> ViewStateGetter
Type alias for a function that returns the current ViewState.

Public Functions

Name
RelativeTimeAxisWidget(QWidget * parent =[nullptr])
Construct a RelativeTimeAxisWidget.
~RelativeTimeAxisWidget() override =default
void setViewStateGetter(ViewStateGetter getter)
Set the function to get the current ViewState.
void setAlignmentTarget(QWidget * target)
Set the widget whose horizontal extent defines the plot area.
void setAxisMapping(CorePlotting::AxisMapping mapping)
Set an AxisMapping to control label formatting and domain interpretation.
void clearAxisMapping()
Clear any previously set AxisMapping, reverting to default formatting.
CorePlotting::AxisMapping const * axisMapping() const
Get the current AxisMapping, if any.
template <typename SenderType >
void
connectToViewStateChanged(SenderType * sender, void(SenderType::*)() signal)
Connect to a QObject signal that indicates view state changes.
QSize sizeHint() const override
Suggested height for the axis widget.

Protected Functions

Name
void paintEvent(QPaintEvent * event) override

Detailed Description

class RelativeTimeAxisWidget;

Widget that renders a horizontal time axis for relative time plots.

Shows:

  • Time range (e.g., -500 to +500 ms)
  • Tick marks at regular intervals
  • Center line at t=0 highlighted
  • Zoom/pan aware positioning

This widget is designed to work with CorePlotting::ViewState, making it reusable across EventPlotWidget, HeatmapWidget, PSTHWidget, and other relative time plots.

Public Types Documentation

using ViewStateGetter

using RelativeTimeAxisWidget::ViewStateGetter =  std::function<CorePlotting::ViewState()>;

Type alias for a function that returns the current ViewState.

Public Functions Documentation

function RelativeTimeAxisWidget

explicit RelativeTimeAxisWidget(
    QWidget * parent =nullptr
)

Construct a RelativeTimeAxisWidget.

Parameters:

  • parent Parent widget

function ~RelativeTimeAxisWidget

~RelativeTimeAxisWidget() override =default

function setViewStateGetter

void setViewStateGetter(
    ViewStateGetter getter
)

Set the function to get the current ViewState.

Parameters:

function setAlignmentTarget

void setAlignmentTarget(
    QWidget * target
)

Set the widget whose horizontal extent defines the plot area.

Parameters:

  • target The widget to align with (typically the QOpenGLWidget)

When the axis widget is wider than the plot (e.g. because a vertical axis sits beside the OpenGL canvas), setting an alignment target ensures that tick marks line up with world-coordinate positions in the target widget rather than being offset.

function setAxisMapping

void setAxisMapping(
    CorePlotting::AxisMapping mapping
)

Set an AxisMapping to control label formatting and domain interpretation.

Parameters:

  • mapping The axis mapping describing world↔︎domain↔︎label relationships

When set, world-coordinate tick values are converted to domain values via the mapping before formatting. This replaces the default relative-time label formatting (“+N”, “-N”, “0”).

function clearAxisMapping

void clearAxisMapping()

Clear any previously set AxisMapping, reverting to default formatting.

function axisMapping

CorePlotting::AxisMapping const * axisMapping() const

Get the current AxisMapping, if any.

Return: Pointer to the mapping, or nullptr if none set

function connectToViewStateChanged

template <typename SenderType >
inline void connectToViewStateChanged(
    SenderType * sender,
    void(SenderType::*)() signal
)

Connect to a QObject signal that indicates view state changes.

Parameters:

  • sender Object that emits the signal
  • signal Pointer to the signal member function

Template Parameters:

  • SenderType Type of the sender object

When the signal is emitted, the widget will call the ViewStateGetter to get the updated state and repaint.

function sizeHint

QSize sizeHint() const override

Suggested height for the axis widget.

Protected Functions Documentation

function paintEvent

void paintEvent(
    QPaintEvent * event
) override

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