Skip to main content

HorizontalAxisWidget

HorizontalAxisWidget

Widget that renders a horizontal axis for plots. More…

#include <HorizontalAxisWidget.hpp>

Inherits from QWidget

Public Types

Name
using std::function< std::pair< double, double >()> RangeGetter
Type alias for a function that returns the current min/max range.

Public Functions

Name
HorizontalAxisWidget(QWidget * parent =[nullptr])
Construct a HorizontalAxisWidget.
~HorizontalAxisWidget() override =default
void setRangeGetter(RangeGetter getter)
Set the function to get the current range.
void setRange(double min, double max)
Set the range directly (for simple cases).
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.
void setDisplayMode(Neuralyzer::Plots::AxisDisplayMode mode)
Set plot or ruler display mode.
void setThickness(int px)
Set the widget thickness in pixels.
void setShowExtentLabels(bool show)
Show or hide min/max extent labels at the bottom.
void setNegativeLabelColor(QColor color)
Set the color used for negative tick values and labels.
void setTickConfig(Neuralyzer::Plots::AxisTickConfig config)
Set tick generation configuration.
template <typename SenderType >
void
connectToRangeChanged(SenderType * sender, void(SenderType::*)() signal)
Connect to a QObject signal that indicates range changes.
QSize sizeHint() const override
Suggested height for the axis widget.

Protected Functions

Name
void paintEvent(QPaintEvent * event) override

Detailed Description

class HorizontalAxisWidget;

Widget that renders a horizontal axis for plots.

Shows:

  • Value range (e.g., 0 to 100)
  • Tick marks at regular intervals
  • Labels for major ticks
  • Updates when range changes

Public Types Documentation

using RangeGetter

using HorizontalAxisWidget::RangeGetter =  std::function<std::pair<double, double>()>;

Type alias for a function that returns the current min/max range.

Public Functions Documentation

function HorizontalAxisWidget

explicit HorizontalAxisWidget(
    QWidget * parent =nullptr
)

Construct a HorizontalAxisWidget.

Parameters:

  • parent Parent widget

function ~HorizontalAxisWidget

~HorizontalAxisWidget() override =default

function setRangeGetter

void setRangeGetter(
    RangeGetter getter
)

Set the function to get the current range.

Parameters:

  • getter Function that returns (min, max) pair

function setRange

void setRange(
    double min,
    double max
)

Set the range directly (for simple cases).

Parameters:

  • min Minimum value
  • max Maximum value

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, the RangeGetter/setRange values are interpreted as domain values. The AxisMapping’s formatLabel is used for tick labels instead of the default decimal formatting.

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 setDisplayMode

void setDisplayMode(
    Neuralyzer::Plots::AxisDisplayMode mode
)

Set plot or ruler display mode.

Parameters:

  • mode Display mode

function setThickness

void setThickness(
    int px
)

Set the widget thickness in pixels.

Parameters:

  • px Height in pixels

function setShowExtentLabels

void setShowExtentLabels(
    bool show
)

Show or hide min/max extent labels at the bottom.

Parameters:

  • show Whether to show extent labels

function setNegativeLabelColor

void setNegativeLabelColor(
    QColor color
)

Set the color used for negative tick values and labels.

Parameters:

  • color Label and tick color when value < 0

function setTickConfig

void setTickConfig(
    Neuralyzer::Plots::AxisTickConfig config
)

Set tick generation configuration.

Parameters:

  • config Tick spacing configuration

function connectToRangeChanged

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

Connect to a QObject signal that indicates range 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 RangeGetter to get the updated range 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