v2.0.0
Loading...
Searching...
No Matches
overviewbarwidget.h
Go to the documentation of this file.
1//=============================================================================================================
35
36#ifndef OVERVIEWBARWIDGET_H
37#define OVERVIEWBARWIDGET_H
38
39//=============================================================================================================
40// INCLUDES
41//=============================================================================================================
42
43#include "../../disp_global.h"
44#include "channelrhiview.h"
45
46//=============================================================================================================
47// QT INCLUDES
48//=============================================================================================================
49
50#include <QImage>
51#include <QPointer>
52#include <QWidget>
53
54//=============================================================================================================
55// DEFINE NAMESPACE DISPLIB
56//=============================================================================================================
57
58namespace DISPLIB
59{
60
61//=============================================================================================================
62// DISPLIB FORWARD DECLARATIONS
63//=============================================================================================================
64
66
67//=============================================================================================================
82{
83 Q_OBJECT
84
85public:
86 static constexpr int kBarHeight = 48;
87
88 explicit OverviewBarWidget(QWidget *parent = nullptr);
89
90 void setModel(ChannelDataModel *model);
91
92 void setFirstFileSample(int first);
93 void setLastFileSample(int last);
94 void setSfreq(float sfreq);
95
96 void setViewport(float scrollSample, float visibleSamples);
97
98 void setEvents(const QVector<ChannelRhiView::EventMarker> &events);
99 void setAnnotations(const QVector<ChannelRhiView::AnnotationSpan> &annotations);
100
101 QSize sizeHint() const override;
102 QSize minimumSizeHint() const override;
103
104signals:
105 void scrollRequested(float targetSample);
106
107protected:
108 void paintEvent(QPaintEvent *event) override;
109 void mousePressEvent(QMouseEvent *event) override;
110 void mouseMoveEvent(QMouseEvent *event) override;
111 void mouseReleaseEvent(QMouseEvent *event) override;
112
113private:
114 float xToSample(int x) const;
115 void rebuildEnvelope();
116
117 QPointer<ChannelDataModel> m_model;
118 int m_firstFileSample = 0;
119 int m_lastFileSample = -1;
120 float m_sfreq = 1000.f;
121
122 float m_scrollSample = 0.f;
123 float m_visibleSamples = 0.f;
124
125 QVector<ChannelRhiView::EventMarker> m_events;
126 QVector<ChannelRhiView::AnnotationSpan> m_annotations;
127
128 QImage m_envelopeImage;
129 bool m_envelopeDirty = true;
130
131 bool m_dragging = false;
132};
133
134} // namespace DISPLIB
135
136#endif // OVERVIEWBARWIDGET_H
disp library export/import macros.
#define DISPSHARED_EXPORT
Definition disp_global.h:51
Declaration of the ChannelRhiView class.
2-D display widgets and visualisation helpers (charts, topography, colour maps).
ChannelDataModel – lightweight data container for ChannelDataView / ChannelRhiView.
void scrollRequested(float targetSample)
void paintEvent(QPaintEvent *event) override
QSize sizeHint() const override
QSize minimumSizeHint() const override
void setAnnotations(const QVector< ChannelRhiView::AnnotationSpan > &annotations)
void setModel(ChannelDataModel *model)
void mouseMoveEvent(QMouseEvent *event) override
void setEvents(const QVector< ChannelRhiView::EventMarker > &events)
void mousePressEvent(QMouseEvent *event) override
void mouseReleaseEvent(QMouseEvent *event) override
OverviewBarWidget(QWidget *parent=nullptr)
void setViewport(float scrollSample, float visibleSamples)
static constexpr int kBarHeight