Commit a96542ab authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Make it possible to export 2D plots

parent 8a90ea18
......@@ -146,3 +146,16 @@ QSGNode* Graph2DMobile::updatePaintNode(QSGNode* node, QQuickItem::UpdatePaintNo
n->setRect(boundingRect());
return n;
}
QStringList Graph2DMobile::filters() const
{
return {QObject::tr("PNG File (*.png)")};
}
bool Graph2DMobile::save(const QUrl& url) const
{
if(!url.isLocalFile())
return false;
return m_buffer.save(url.toLocalFile());
}
......@@ -39,6 +39,7 @@ class Graph2DMobile : public QQuickItem, public Analitza::Plotter2D
Q_PROPERTY(bool currentFunction READ currentFunction WRITE setCurrentFunction)
Q_PROPERTY(bool ticksShown READ ticksShownAtAll WRITE setTicksShownAtAll)
Q_PROPERTY(bool minorTicksShown READ minorTicksShown WRITE setShowMinorTicks)
Q_PROPERTY(QStringList filters READ filters CONSTANT)
public:
Graph2DMobile(QQuickItem* parent = 0);
......@@ -54,11 +55,14 @@ class Graph2DMobile : public QQuickItem, public Analitza::Plotter2D
bool ticksShownAtAll() const { return ticksShown()!=0; }
void setTicksShownAtAll(bool shown);
QStringList filters() const;
public Q_SLOTS:
void translate(qreal x, qreal y);
void scale(qreal s, int x, int y);
void resetViewport();
QStringList addFunction(const QString& expression, const QSharedPointer<Analitza::Variables>& vars = {});
bool save(const QUrl &url) const;
private Q_SLOTS:
void updateFuncs(const QModelIndex& start, const QModelIndex& end);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment