aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Fadel <samuelfadel@gmail.com>2016-01-28 11:38:50 +0100
committerSamuel Fadel <samuelfadel@gmail.com>2016-01-28 11:38:50 +0100
commitb7d624feb33826e63df44ec8706ecaca885f7da5 (patch)
tree46fae6e7b947a68bc8e3e545bbc32a0569db68ea
parentc67ef06f2f3062455e985152f52be89f1071c36f (diff)
Scatterplot: handle right clicks (clear selection) and absence of color data.
-rw-r--r--scatterplot.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/scatterplot.cpp b/scatterplot.cpp
index d97f83d..7666f28 100644
--- a/scatterplot.cpp
+++ b/scatterplot.cpp
@@ -545,7 +545,11 @@ void Scatterplot::updateGlyphs(QSGNode *glyphsNode)
glyphOutlineNode->markDirty(QSGNode::DirtyMaterial);
material = static_cast<QSGFlatColorMaterial *>(glyphNode->material());
- material->setColor(m_colorScale.color(m_colorData[i]));
+ if (m_colorData.n_elem > 0) {
+ material->setColor(m_colorScale.color(m_colorData[i]));
+ } else {
+ material->setColor(QColor());
+ }
glyphNode->markDirty(QSGNode::DirtyMaterial);
}
@@ -615,7 +619,7 @@ void Scatterplot::mouseReleaseEvent(QMouseEvent *event)
switch (m_currentInteractionState) {
case INTERACTION_NONE:
case INTERACTION_SELECTED:
- if (m_brushedItem < 0) {
+ if (m_brushedItem < 0 || event->button() == Qt::RightButton) {
// Mouse clicked with no brush target; clear selection, if any
m_selection.assign(m_selection.size(), false);
m_shouldUpdateMaterials = true;