I have knew that the second line end with a \n.and it should be the second possibility,but,before I start the program,I set the process like this:
inprocess.
setReadChannelMode(QProcess::MergedChannels);
inprocess.setReadChannelMode(QProcess::MergedChannels);
To copy to clipboard, switch view to plain text mode
and in the connect, I write like this:
connect(&inprocess,SIGNAL(readyReadStandardOutput()),this,SLOT(iupdateTextEdit()));
connect(&inprocess,SIGNAL(readyReadStandardError()),this,SLOT(iupdateTextEdit()));
connect(&inprocess,SIGNAL(readyReadStandardOutput()),this,SLOT(iupdateTextEdit()));
connect(&inprocess,SIGNAL(readyReadStandardError()),this,SLOT(iupdateTextEdit()));
To copy to clipboard, switch view to plain text mode
the following show the iupdateTextEdit() fuction
void mainWindow::iupdateTextEdit()
{
QByteArray newData
=inprocess.
readAllStandardOutput();
textEdit->setPlainText(text);
}
void mainWindow::iupdateTextEdit()
{
QByteArray newData=inprocess.readAllStandardOutput();
QString text=textEdit->toPlainText()+QString::fromLocal8Bit(newData);
textEdit->setPlainText(text);
}
To copy to clipboard, switch view to plain text mode
even so,it can't show the second line in the textEdit.
Bookmarks