It doesn't work, I tried with the function and with no QProcess inheritance, now the class process inherits from QProcess and it doesn't work, but is the same sh*t.
The code looks like this:
process::process()
{
qDebug()<<isOpen()<<"is open";
qDebug()<<"pass on start";
// qDebug()<<waitForStarted()<<"wait4started";
// write("plot sin(x);pause -1;");
// qDebug()<<"pass on plot";
// execute("plot sin(x);pause -1");
// qDebug()<<readAll();
}
void process::prun()
{
if(!waitForStarted()) return;
write("plot sin(x); pause -1;");
qDebug()<<"pass on plot";
// QProcess *gnuplot = new QProcess;
//
// gnuplot->start("gnuplot",QIODevice::ReadWrite);
//
// qDebug()<<gnuplot->isOpen()<<"is open";
// qDebug()<<"pass on start";
//
// while(!gnuplot->waitForStarted()) return;
// qDebug()<<gnuplot->waitForStarted()<<"wait4started";
// gnuplot->write("plot sin(x);pause -1;");
// qDebug()<<"pass on plot";
//
// qDebug()<<gnuplot->readAll();
}
process::process()
{
start("gnuplot",QIODevice::ReadWrite);
qDebug()<<isOpen()<<"is open";
qDebug()<<"pass on start";
// qDebug()<<waitForStarted()<<"wait4started";
// write("plot sin(x);pause -1;");
// qDebug()<<"pass on plot";
// execute("plot sin(x);pause -1");
// qDebug()<<readAll();
}
void process::prun()
{
if(!waitForStarted()) return;
write("plot sin(x); pause -1;");
qDebug()<<"pass on plot";
// QProcess *gnuplot = new QProcess;
//
// gnuplot->start("gnuplot",QIODevice::ReadWrite);
//
// qDebug()<<gnuplot->isOpen()<<"is open";
// qDebug()<<"pass on start";
//
// while(!gnuplot->waitForStarted()) return;
// qDebug()<<gnuplot->waitForStarted()<<"wait4started";
// gnuplot->write("plot sin(x);pause -1;");
// qDebug()<<"pass on plot";
//
// qDebug()<<gnuplot->readAll();
}
To copy to clipboard, switch view to plain text mode
and the output looks like this:
true is open
pass on start
pass on plot
QProcess: Destroyed while process is still running.
Bookmarks