aboutsummaryrefslogtreecommitdiff
path: root/barchart.h
diff options
context:
space:
mode:
authorSamuel Fadel <samuelfadel@gmail.com>2016-01-21 19:36:14 +0100
committerSamuel Fadel <samuelfadel@gmail.com>2016-01-21 19:36:14 +0100
commitd414b68cea008edc063e26133564d120a7430bd2 (patch)
tree7ae861a100d0b1560294b646014743dcd785ab4b /barchart.h
parente9d14f93498832687cbdbeb79748f9030e49fb2f (diff)
Added selection linking. Needs more tests.
Diffstat (limited to 'barchart.h')
-rw-r--r--barchart.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/barchart.h b/barchart.h
index d785aa9..d49c001 100644
--- a/barchart.h
+++ b/barchart.h
@@ -4,7 +4,6 @@
#include <vector>
#include <QtQuick>
-#include <QSet>
#include <armadillo>
@@ -22,11 +21,13 @@ public:
signals:
void valuesChanged(const arma::vec &values) const;
void colorScaleChanged(const ColorScale &scale) const;
- void selectionChanged(const QSet<int> &selection) const;
+ void selectionChanged(const std::vector<bool> &selection) const;
+ void selectionInteractivelyChanged(const std::vector<bool> &selection) const;
public slots:
void setValues(const arma::vec &values);
void setColorScale(const ColorScale &scale);
+ void setSelection(const std::vector<bool> &selection);
protected:
QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *);
@@ -53,9 +54,11 @@ private:
void updateSelectionRect(QSGNode *node);
bool m_shouldUpdateSelectionRect;
- void selectBarsInRange(float start, float end);
+ void interactiveSelection(float start, float end);
float m_dragStartPos, m_dragLastPos;
- QSet<int> m_selection;
+ std::vector<bool> m_selection;
+
+ int itemAt(float x, bool includeSelectorWidth = false) const;
arma::vec m_values;
ColorScale m_colorScale;