I have a QT C ++ application that runs an Octave program using QProcess. I can communicate with him by reading standard output / error and writing standard input to it using the write method (for example: octave-> write ("5 + 5 \ n");).
As I said, I get a response from an octave (from the above example, I get "ans = 10").
However, when the command I am writing for Octave standard input has a βgraphβ (for example, a simple graph ([1 2 3 4 5]);), the actual graph is never displayed. I know that Octave launches gnuplot, I installed it and gnuplot_x11 too. I even change the gnuplot binary path in my Octave process by doing gnuplot_binary ("/ usr / bin / gnuplot"); from MY APPLICATION. I know that this works well, because if I get a new value, I get it right. But I do not know why Octave does not show graphics.
Here I start an octave:
QStringList arguments; arguments << "--persist"; octave->setProcessChannelMode(QProcess::MergedChannels); octave->start("/usr/bin/octave", arguments);
Here I write the commands for the octave process:
if (octave->state() == QProcess::Running) { QString command = widget.txtInput->toPlainText(); if (command.isEmpty()) { return; } command += "\n"; octave->write(command.toAscii()); }
With this, I print an octave response to text editing:
widget.txtOutput->append(octave->readAll() + "\n");
And finally, I use this when the octave process begins:
QString gnuplot_path(tr("\"/usr/bin/gnuplot\"")); QString gnuplot_cmd(tr("gnuplot_binary(%1)\n").arg(gnuplot_path)); octave->write(gnuplot_cmd.toAscii());
I would be grateful for any help you could give me.
Thanks in advance.
source share