diff options
-rw-r--r-- | scatterplot.cpp | 19 | ||||
-rw-r--r-- | scatterplot.h | 7 |
2 files changed, 9 insertions, 17 deletions
diff --git a/scatterplot.cpp b/scatterplot.cpp index 4ef266b..4c8e169 100644 --- a/scatterplot.cpp +++ b/scatterplot.cpp @@ -234,15 +234,6 @@ arma::mat Scatterplot::XY() const return m_xy; } -bool Scatterplot::saveToFile(const QUrl &url) -{ - if (!url.isLocalFile()) { - return false; - } - - return m_xy.save(url.path().toStdString(), arma::raw_ascii); -} - void Scatterplot::setXY(const arma::mat &xy) { if (xy.n_cols != 2) { @@ -329,15 +320,17 @@ void Scatterplot::autoScale() emit scaleChanged(m_sx, m_sy); } -void Scatterplot::setGlyphSize(float glyphSize, bool updateView) +void Scatterplot::setGlyphSize(float glyphSize) { + if (m_glyphSize == glyphSize || glyphSize < 2.0f) { + return; + } + m_glyphSize = glyphSize; emit glyphSizeChanged(m_glyphSize); m_shouldUpdateGeometry = true; - if (updateView) { - update(); - } + update(); } QSGNode *Scatterplot::newSceneGraph() diff --git a/scatterplot.h b/scatterplot.h index 1b40040..f12c658 100644 --- a/scatterplot.h +++ b/scatterplot.h @@ -16,6 +16,7 @@ class Scatterplot : public QQuickItem { Q_OBJECT + Q_PROPERTY(float glyphSize READ glyphSize WRITE setGlyphSize NOTIFY glyphSizeChanged) public: static const int PADDING = 20; @@ -24,9 +25,8 @@ public: arma::mat XY() const; void setColorScale(const ColorScale &colorScale); void setAutoScale(bool autoScale); - Q_INVOKABLE bool saveToFile(const QUrl &url); - - Q_INVOKABLE float glyphSize() const { return m_glyphSize; } + float glyphSize() const { return m_glyphSize; } + void setGlyphSize(float glyphSize); void setDragEnabled(bool enabled) { m_dragEnabled = enabled; } bool isDragEnabled() const { return m_dragEnabled; } @@ -50,7 +50,6 @@ public slots: void setScale(const LinearScale<float> &sx, const LinearScale<float> &sy); void setSelection(const std::vector<bool> &selection); void brushItem(int item); - Q_INVOKABLE void setGlyphSize(float glyphSize, bool updateView = true); protected: QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *); |