1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
#pragma once
#include "graphview.h"
/**
* Histogram graph view.
*
* When the view is zoomed such that there is more than one item occupying
* a single pixel the one with the highest value will be displayed.
*/
class HistogramView : public GraphView {
public:
HistogramView(QWidget* parent);
void setDataProvider(GraphDataProvider* data);
void setSelectionState(SelectionState* state) override;
/* Gradient colours for selected and unselected items */
void setSelectedGradient(const QLinearGradient& gradient);
void setUnelectedGradient(const QLinearGradient& gradient);
virtual void mouseMoveEvent(QMouseEvent *e) override;
virtual void mouseDoubleClickEvent(QMouseEvent *e) override;
virtual void update() override;
virtual void resizeEvent(QResizeEvent *e) override;
virtual void paintEvent(QPaintEvent *e) override;
protected:
qint64 itemAtPosition(QPoint pos);
qint64 valueAtPosition(QPoint pos);
protected:
QLinearGradient m_gradientSelected;
QLinearGradient m_gradientUnselected;
GraphDataProvider* m_data;
};
|