blob: ccbb13ee9e961d53538feae8da7668dd061ccd46 (
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);
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();
void updateBarNodeGeom(QSGNode *barNode, float x, float width, float height);
void updateBars(QSGNode *root);
arma::vec m_values;
bool m_shouldUpdateBars;
};
#endif // BARCHART_H
|