diff options
author | Samuel Fadel <samuelfadel@gmail.com> | 2016-01-18 19:42:20 +0100 |
---|---|---|
committer | Samuel Fadel <samuelfadel@gmail.com> | 2016-01-18 19:48:28 +0100 |
commit | c4c6f50b6ae5b9281e872a83602799b73522c24d (patch) | |
tree | 6d0c5da36770534d1185a55ad05d61f605b3209f | |
parent | 3f82e644c40def869a5b5d294573982cec7b057c (diff) |
BarChart & Scatterplot: added hints for vertex data upload.
* BarChart: additionally, removed hover event handler and added a
movement event handler
* Scatterplot: changed selected/unselected outline colors;
unselected is now black, selected is a really bright blue
-rw-r--r-- | barchart.cpp | 14 | ||||
-rw-r--r-- | barchart.h | 3 | ||||
-rw-r--r-- | scatterplot.cpp | 6 |
3 files changed, 16 insertions, 7 deletions
diff --git a/barchart.cpp b/barchart.cpp index f21f874..c2f7255 100644 --- a/barchart.cpp +++ b/barchart.cpp @@ -73,6 +73,7 @@ QSGNode *BarChart::newBarNode() const //QSGGeometry *outlineGeometry = // new QSGGeometry(QSGGeometry::defaultAttributes_Point2D(), 4); //outlineGeometry->setDrawingMode(GL_LINE_LOOP); + //outlineGeometry->setVertexDataPattern(QSGGeometry::DynamicPattern); //outlineGeomNode->setGeometry(outlineGeometry); //outlineGeomNode->setFlag(QSGNode::OwnsGeometry); //QSGFlatColorMaterial *material = new QSGFlatColorMaterial; @@ -84,6 +85,7 @@ QSGNode *BarChart::newBarNode() const QSGGeometry *barGeometry = new QSGGeometry(QSGGeometry::defaultAttributes_Point2D(), 4); barGeometry->setDrawingMode(GL_POLYGON); + barGeometry->setVertexDataPattern(QSGGeometry::DynamicPattern); barGeomNode->setGeometry(barGeometry); barGeomNode->setFlag(QSGNode::OwnsGeometry); QSGFlatColorMaterial *material = new QSGFlatColorMaterial; @@ -173,10 +175,10 @@ QSGNode *BarChart::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) return root; } -void BarChart::hoverMoveEvent(QHoverEvent *event) -{ - // TODO -} +// TODO +//void BarChart::hoverMoveEvent(QHoverEvent *event) +//{ +//} void BarChart::mousePressEvent(QMouseEvent *event) { @@ -184,6 +186,10 @@ void BarChart::mousePressEvent(QMouseEvent *event) setCursor(dragCursor); } +void BarChart::mouseMoveEvent(QMouseEvent *event) +{ +} + void BarChart::mouseReleaseEvent(QMouseEvent *event) { unsetCursor(); @@ -28,8 +28,9 @@ public slots: protected: QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *); - void hoverMoveEvent(QHoverEvent *event); + // void hoverMoveEvent(QHoverEvent *event); void mousePressEvent(QMouseEvent *event); + void mouseMoveEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event); private: diff --git a/scatterplot.cpp b/scatterplot.cpp index 366583b..7f15eaf 100644 --- a/scatterplot.cpp +++ b/scatterplot.cpp @@ -11,8 +11,8 @@ static const qreal GLYPH_OPACITY = 1.0; static const qreal GLYPH_OPACITY_SELECTED = 1.0; -static const QColor GLYPH_OUTLINE_COLOR(225, 225, 225); -static const QColor GLYPH_OUTLINE_COLOR_SELECTED(0, 0, 0); +static const QColor GLYPH_OUTLINE_COLOR(0, 0, 0); +static const QColor GLYPH_OUTLINE_COLOR_SELECTED(20, 255, 225); static const QColor SELECTION_COLOR(128, 128, 128, 96); static const float DEFAULT_GLYPH_SIZE = 8.0f; @@ -194,6 +194,7 @@ QSGNode *Scatterplot::newGlyphTree() for (arma::uword i = 0; i < m_xy.n_rows; i++) { QSGGeometry *glyphOutlineGeometry = new QSGGeometry(QSGGeometry::defaultAttributes_Point2D(), vertexCount); glyphOutlineGeometry->setDrawingMode(GL_POLYGON); + glyphOutlineGeometry->setVertexDataPattern(QSGGeometry::DynamicPattern); QSGGeometryNode *glyphOutlineNode = new QSGGeometryNode; glyphOutlineNode->setGeometry(glyphOutlineGeometry); glyphOutlineNode->setFlag(QSGNode::OwnsGeometry); @@ -205,6 +206,7 @@ QSGNode *Scatterplot::newGlyphTree() QSGGeometry *glyphGeometry = new QSGGeometry(QSGGeometry::defaultAttributes_Point2D(), vertexCount); glyphGeometry->setDrawingMode(GL_POLYGON); + glyphGeometry->setVertexDataPattern(QSGGeometry::DynamicPattern); QSGGeometryNode *glyphNode = new QSGGeometryNode; glyphNode->setGeometry(glyphGeometry); glyphNode->setFlag(QSGNode::OwnsGeometry); |