Hi,
I'm new to QT and I can't get calling external programs to work. I have this:
class mainwindow
: public QMainWindow,
public Ui
::MainWindow{ Q_OBJECT
private:
[...]
[...]
class mainwindow : public QMainWindow, public Ui::MainWindow{
Q_OBJECT
private:
[...]
QProcess* proc;
[...]
To copy to clipboard, switch view to plain text mode
void mainwindow::doit(){
arguments << "test";
connect(proc, SIGNAL(readyReadStdout()), this, SLOT(readFromStdout()));
if(!proc->start(program, arguments)){
QMessageBox::critical(0,
"fatal error",
"could not start",
"quit");
exit(-1);
}
}
void mainwindow::readFromStdout(){
textEdit->append(???);
}
void mainwindow::doit(){
QString program="/usr/bin/echo";
QStringList arguments;
arguments << "test";
proc=new QProcess(parent);
connect(proc, SIGNAL(readyReadStdout()), this, SLOT(readFromStdout()));
if(!proc->start(program, arguments)){
QMessageBox::critical(0,"fatal error", "could not start", "quit");
exit(-1);
}
}
void mainwindow::readFromStdout(){
textEdit->append(???);
}
To copy to clipboard, switch view to plain text mode
First, the "start" does not work:
mainwindow.
cpp:29: error
: no matching function
for call to ‘
QProcess::QProcess(<unresolved overloaded function type>
)’
mainwindow.cpp:29: error: no matching function for call to ‘QProcess::QProcess(<unresolved overloaded function type>)’
To copy to clipboard, switch view to plain text mode
Second, what to append to textEdit?
Can someone help?
Bookmarks