totosugito
30th January 2008, 09:58
Dear,
I want to use QProcess to solve my problem.
in my form, I have :
1. lineedit to input command cell
2. pushbutton to process command
3. textedit for output process
in my script i want to insert text :
txtOutput->append("operation ending");
after qprocess ending, but in my script, this text appear in top of output not in bottom textoutput.
this script execute before process ending.
how to make this script execute after qprocess ending?
this is complete my scripts :
#include "qtwiggle.h"
qtwiggle::qtwiggle(QWidget* parent)
: QMainWindow(parent)
{
setupUi(this);
setWindowTitle(tr("Tape Utilities"));
}
void qtwiggle::on_btnRun_clicked()
{
QString perintah=txtInput->text();
proc= new QProcess();
proc->start("/bin/bash", QStringList() << "-c" << perintah);
connect(proc, SIGNAL(readyReadStandardOutput()),this, SLOT(rightc()) );
connect(proc, SIGNAL(readyReadStandardError()), this, SLOT(wrongc()) );
txtOutput->append("operation ending");
}
void qtwiggle::rightc()
{
QByteArray databaca = proc->readAllStandardOutput();
txtOutput->append(databaca);
}
void qtwiggle::wrongc()
{
QByteArray databaca = proc->readAllStandardError();
txtOutput->append(databaca);
}
thank you
I want to use QProcess to solve my problem.
in my form, I have :
1. lineedit to input command cell
2. pushbutton to process command
3. textedit for output process
in my script i want to insert text :
txtOutput->append("operation ending");
after qprocess ending, but in my script, this text appear in top of output not in bottom textoutput.
this script execute before process ending.
how to make this script execute after qprocess ending?
this is complete my scripts :
#include "qtwiggle.h"
qtwiggle::qtwiggle(QWidget* parent)
: QMainWindow(parent)
{
setupUi(this);
setWindowTitle(tr("Tape Utilities"));
}
void qtwiggle::on_btnRun_clicked()
{
QString perintah=txtInput->text();
proc= new QProcess();
proc->start("/bin/bash", QStringList() << "-c" << perintah);
connect(proc, SIGNAL(readyReadStandardOutput()),this, SLOT(rightc()) );
connect(proc, SIGNAL(readyReadStandardError()), this, SLOT(wrongc()) );
txtOutput->append("operation ending");
}
void qtwiggle::rightc()
{
QByteArray databaca = proc->readAllStandardOutput();
txtOutput->append(databaca);
}
void qtwiggle::wrongc()
{
QByteArray databaca = proc->readAllStandardError();
txtOutput->append(databaca);
}
thank you