diff options
Diffstat (limited to 'barchart.h')
-rw-r--r-- | barchart.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/barchart.h b/barchart.h new file mode 100644 index 0000000..ccbb13e --- /dev/null +++ b/barchart.h @@ -0,0 +1,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 |