Same problem with QProcess. Program works but there is no “Wait” information shown. After I click button program does it’s job well and after a while there’s just “Done”.
#include <QtGui>
#include "Form.h"
Form::Form(QWidget* parent){
setupUi(this);
connect(pushButton, SIGNAL(clicked()), this, SLOT(generate()));
converterProc = new QProcess(this);
connect(converterProc, SIGNAL(started()), this, SLOT(converterStarted()));
connect(converterProc, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(converterFinished()));
}
void Form::generate(){
QFile file("word_list.txt");
file.open(QIODevice::ReadWrite | QIODevice::Truncate | QIODevice::Text);
QTextStream fileStream(&file);
fileStream << plainTextEdit->toPlainText();
file.close();
converterProc->start("./converter word_list.txt");
converterProc->waitForFinished();
}
void Form::converterStarted(){
label_2->setText("Wait!");
label_2->repaint();
}
void Form::converterFinished(){
label_2->setText("Done!");
label_2->repaint();
}
↧