I just can't get the output of "GNU locate" onto the Textedit Widget. Infact, the QByteArray is being detected empty!!
if i start the process in startDetached(...) I can see the output on my terminal! but using only start(...) I can't seem to get it working!!
Help pls...
#include <QApplication>
#include <QString>
#include <QWidget>
#include <QLabel>
#include <QProcess>
#include <QTextEdit>
#include <QTextStream>
#include <QByteArray>
int main(int argc,char *argv[])
{
w->setGeometry(0,0,300,300);
locate.
setReadChannel(QProcess::StandardOutput);
locate.start("locate *.mymenu");
QByteArray results
=locate.
readAllStandardOutput();
//readAll() too didn't work
if(results.isEmpty())
{
w->setWindowTitle("Sorry...doesn't work!");
}
output->setPlainText(data.readAll());
w->show();
return app.exec();
}
#include <QApplication>
#include <QString>
#include <QWidget>
#include <QLabel>
#include <QProcess>
#include <QTextEdit>
#include <QTextStream>
#include <QByteArray>
int main(int argc,char *argv[])
{
QApplication app(argc,argv);
QWidget *w=new QWidget(0);
w->setGeometry(0,0,300,300);
QTextEdit *output=new QTextEdit(w);
QProcess locate;
locate.setReadChannel(QProcess::StandardOutput);
locate.start("locate *.mymenu");
QByteArray results=locate.readAllStandardOutput(); //readAll() too didn't work
if(results.isEmpty())
{
w->setWindowTitle("Sorry...doesn't work!");
}
QTextStream data(&results);
output->setPlainText(data.readAll());
w->show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Thanks
Bookmarks