I have
class Lotto : public QProcess {
Q_OBJECT
public:
Lotto();
~Lotto();
public slots:
void showOutput();
};
Lotto.cpp
Lotto::Lotto(){
connect(this, SIGNAL(readyReadStandardOutput()), this, SLOT(showOutput()));
start("Lotto.exe"
}
Lotto::~Lotto(){}
void Lotto::showOutput(){ //this is not working if i use a QApp, i only get an empty window.
QByteArray bytes = readAllStandardOutput();
QString numbers = bytes.data();
qDebug() << numbers;
}
int main(){}
How do i call/use my Lotto class in the main method.
i tried Lotto* l;
l->start("Lotto); but it does not work.
When i test using this which does not use my lotto program, i get the an output but not satisfactory as i get a warning.
[...]
int main(int argc,char** argv){
QProcess cmd;
cmd.start("LottoNumbers.exe"
;
if (!cmd.waitForStarted())
return false;
cmd.waitForReadyRead();
QByteArray result = cmd.readAllStandardOutput();
qDebug() << result.data();
return 0;
}
48, 42, 40, 5, 13, 34 QProcess object destroyed while process is still running.