v2.0.0
Loading...
Searching...
No Matches
DISPLIB::TimeRulerWidget Class Reference

TimeRulerWidget – a thin horizontal time axis ruler for ChannelDataView. More...

#include <timerulerwidget.h>

Public Slots

void setScrollSample (float sample)
void setSamplesPerPixel (float spp)

Signals

void addReferenceMarkerRequested (int sample)
void removeReferenceMarkerRequested (int sample)
void clearReferenceMarkersRequested ()

Public Member Functions

 TimeRulerWidget (QWidget *parent=nullptr)
void setSfreq (double sfreq)
void setFirstFileSample (int firstFileSample)
QSize sizeHint () const override
QSize minimumSizeHint () const override
void setEvents (const QVector< TimeRulerEventMark > &events)
void setReferenceMarkers (const QVector< TimeRulerReferenceMark > &markers)
void toggleTimeFormat ()
void setClockTimeFormat (bool useClock)
bool clockTimeFormat () const

Static Public Attributes

static constexpr int kStimZoneH = 16
 Height of the stimulus lane (px).
static constexpr int kTimeZoneH = 28
 Height of the time-tick zone (px).
static constexpr int kTotalH = kStimZoneH + kTimeZoneH
 Total widget height (px).

Protected Member Functions

void paintEvent (QPaintEvent *event) override
void contextMenuEvent (QContextMenuEvent *event) override

Detailed Description

TimeRulerWidget – a thin horizontal time axis ruler for ChannelDataView.

Displays time ticks and labels beneath the signal viewport. Auto-computes a "nice" tick interval so approximately 7 major ticks are visible regardless of zoom level. Labels show elapsed seconds from the start of the file or, for longer ranges, a MM:SS clock format.

The ruler is driven by two Q_PROPERTY-compatible slots that mirror the ChannelRhiView properties:

Definition at line 95 of file timerulerwidget.h.

Inheritance diagram for DISPLIB::TimeRulerWidget:
Inheritance graph

Constructor & Destructor Documentation

◆ TimeRulerWidget()

TimeRulerWidget::TimeRulerWidget ( QWidget * parent = nullptr)
explicit

Definition at line 77 of file timerulerwidget.cpp.

Member Function Documentation

◆ addReferenceMarkerRequested

void DISPLIB::TimeRulerWidget::addReferenceMarkerRequested ( int sample)
signal

Emitted when the user requests a new sample marker from the ruler context menu.

◆ clearReferenceMarkersRequested

void DISPLIB::TimeRulerWidget::clearReferenceMarkersRequested ( )
signal

Emitted when the user requests that all sample markers be cleared.

◆ clockTimeFormat()

bool DISPLIB::TimeRulerWidget::clockTimeFormat ( ) const
inline

Definition at line 156 of file timerulerwidget.h.

◆ contextMenuEvent()

void TimeRulerWidget::contextMenuEvent ( QContextMenuEvent * event)
overrideprotected

Definition at line 418 of file timerulerwidget.cpp.

◆ minimumSizeHint()

QSize DISPLIB::TimeRulerWidget::minimumSizeHint ( ) const
inlineoverride

Definition at line 124 of file timerulerwidget.h.

◆ paintEvent()

void TimeRulerWidget::paintEvent ( QPaintEvent * event)
overrideprotected

Definition at line 221 of file timerulerwidget.cpp.

◆ removeReferenceMarkerRequested

void DISPLIB::TimeRulerWidget::removeReferenceMarkerRequested ( int sample)
signal

Emitted when the user requests removal of the nearest sample marker from the ruler context menu.

◆ setClockTimeFormat()

void TimeRulerWidget::setClockTimeFormat ( bool useClock)

Set whether to use clock time (HH:MM:SS) or float seconds for labels.

Parameters
[in]useClocktrue = HH:MM:SS, false = float seconds.

Definition at line 178 of file timerulerwidget.cpp.

◆ setEvents()

void TimeRulerWidget::setEvents ( const QVector< TimeRulerEventMark > & events)

Set the list of stimulus / event marks to display in the stim lane. Pass an empty vector to clear all marks.

Parameters
[in]eventsEvent marks (sample position + colour + label).

Definition at line 102 of file timerulerwidget.cpp.

◆ setFirstFileSample()

void TimeRulerWidget::setFirstFileSample ( int firstFileSample)

Set the absolute sample index of the left viewport edge (file-relative). Also records the file's first sample so labels show elapsed time.

Parameters
[in]firstFileSampleThe absolute sample index of the first sample in the file.

Definition at line 94 of file timerulerwidget.cpp.

◆ setReferenceMarkers()

void TimeRulerWidget::setReferenceMarkers ( const QVector< TimeRulerReferenceMark > & markers)

Set the list of persistent sample markers to display in the ruler.

Parameters
[in]markersReference/sample markers.

Definition at line 110 of file timerulerwidget.cpp.

◆ setSamplesPerPixel

void TimeRulerWidget::setSamplesPerPixel ( float spp)
slot

Update the horizontal zoom and trigger a repaint.

Parameters
[in]sppSamples per pixel.

Definition at line 128 of file timerulerwidget.cpp.

◆ setScrollSample

void TimeRulerWidget::setScrollSample ( float sample)
slot

Update the left-edge scroll position and trigger a repaint.

Parameters
[in]sampleAbsolute sample index at the left edge of the view.

Definition at line 118 of file timerulerwidget.cpp.

◆ setSfreq()

void TimeRulerWidget::setSfreq ( double sfreq)

Set the file sampling frequency. Must be called before the first paint.

Parameters
[in]sfreqSampling frequency in Hz.

Definition at line 86 of file timerulerwidget.cpp.

◆ sizeHint()

QSize DISPLIB::TimeRulerWidget::sizeHint ( ) const
inlineoverride

Definition at line 123 of file timerulerwidget.h.

◆ toggleTimeFormat()

void TimeRulerWidget::toggleTimeFormat ( )

Toggle the time format between float seconds and HH:MM:SS clock time.

Definition at line 170 of file timerulerwidget.cpp.

Member Data Documentation

◆ kStimZoneH

int DISPLIB::TimeRulerWidget::kStimZoneH = 16
staticconstexpr

Height of the stimulus lane (px).

Definition at line 119 of file timerulerwidget.h.

◆ kTimeZoneH

int DISPLIB::TimeRulerWidget::kTimeZoneH = 28
staticconstexpr

Height of the time-tick zone (px).

Definition at line 120 of file timerulerwidget.h.

◆ kTotalH

int DISPLIB::TimeRulerWidget::kTotalH = kStimZoneH + kTimeZoneH
staticconstexpr

Total widget height (px).

Definition at line 121 of file timerulerwidget.h.


The documentation for this class was generated from the following files: