Sorry about the other duplicate post. The one I was referred to helped out a lot but it isn't compiling.
QProcess *proc = new QProcess;
connect(proc, SIGNAL(readyRead()), this, SLOT(updateText()));
proc->start("pathToScript");
The second line gives me this error,
error: expected constructor, destructor, or type conversion before '(' token
and the third gives me this one,
error: 'proc' does not name a type
Edit: The rest of my code.
ThiWindow.h:
#ifndef THIWINDOW_H
#define THIWINDOW_H
#include <QMainWindow>
namespace Ui {
class ThiWindow;
}
class ThiWindow : public QMainWindow
{
Q_OBJECT
public:
explicit ThiWindow(QWidget *parent = 0);
~ThiWindow();
signals:
void readyRead();
private slots:
void updateText();
private:
Ui::ThiWindow *ui;
};
ThiWindow.cpp:
#endif // THIWINDOW_H
#include "thiwindow.h"
#include "ui_thiwindow.h"
#include <QProcess>
QProcess *proc = new QProcess;
connect(proc, SIGNAL(readyRead()), this, SLOT(updateText()));
proc->start("pathToScript");
ThiWindow::ThiWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::ThiWindow)
{
ui->setupUi(this);
}
ThiWindow::~ThiWindow()
{
delete ui;
}
void ThiWindow::updateText()
{
QString appendText(proc->readAll());
ui->textEdit->append(appendText);
}
and main.cpp:
#include "mainwindow.h"
#include "mainwindow.cpp"
#include <QApplication>
using namespace std;
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow qw;
qw.show();
return a.exec();
}
Please Help,
Brooks Rady