Reading a console output into QListWidget
-
wrote on 13 Jun 2014, 11:24 last edited by
Hey i've banging my head over this over a week now!
i need to run a script through Qt GUI app!
this scripts simply lists all the groups in the system( ie. runs /bin/./groups)
now i want this output in the QListWidget!
i run the script using QProcess!
bt im not able to get the output of the script to the GUI
i know i have to use readAllStandardOutput(); bt how???????
pls help me and consider me a noob! :( -
wrote on 13 Jun 2014, 12:37 last edited by
That's how I always do it:
@
QProcess *testProcessServer = new QProcess();
QStringList argumentsServer;
testProcessServer->setProcessChannelMode(QProcess::MergedChannels);
testProcessServer->start(programServer, argumentsServer);
int status = 0;
if (!testProcessServer->waitForStarted())
{
// do something here
}
textbox->append(QString(testProcessServer->readAll()));
@ -
wrote on 13 Jun 2014, 15:40 last edited by
[quote author="butterface" date="1402663078"]That's how I always do it:
@
QProcess *testProcessServer = new QProcess();
QStringList argumentsServer;
testProcessServer->setProcessChannelMode(QProcess::MergedChannels);
testProcessServer->start(programServer, argumentsServer);
int status = 0;
if (!testProcessServer->waitForStarted())
{
// do something here
}
textbox->append(QString(testProcessServer->readAll()));
@[/quote]
Thanks for the reply! well i solves the issue!
i said i have to display into QListWidget!
can we convert QByteArray to QStringList? -
Hi,
Like in the example, build the string from the QByteArray and then just split the string on the "\n" char
1/4