blob: 164e0ebd8e4b2aab4e26e34acca325f6fa56c06a (
plain)
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
|
#ifndef BARCHART_H
#define BARCHART_H
#include <QtQuick>
#include <armadillo>
class BarChart : public QQuickItem
{
Q_OBJECT
public:
BarChart(QQuickItem *parent = 0);
~BarChart();
signals:
void valuesChanged(const arma::vec &values) const;
public slots:
void setValues(const arma::vec &values);
protected:
QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *);
void hoverMoveEvent(QHoverEvent *event);
void mousePressEvent(QMouseEvent *event);
private:
QSGNode *newBarNode() const;
void updateBarNodeGeom(QSGNode *barNode, float x, float width, float height);
void updateBars(QSGNode *root);
arma::vec m_values;
bool m_shouldUpdateBars;
};
#endif // BARCHART_H
|