In my application, I convert an Excel spreadsheet into a tab-delimited file. This is done by running a Windows Powershell script into a QProcess.
My problem is that the finished() signal is never emitted, although the conversion is done successfully. And yes, I receive stateChanged() signal.

Powershell script
param ([string]$ent = $null, [string]$sal = $null)
$xlCSV = -4158 #value for tab delimited file
$Excel = New-Object -Com Excel.Application
$Excel.visible = $False
$Excel.displayalerts=$False
$b = $Excel.Workbooks.Open($ent)
$b.SaveAs($sal,$xlCSV)
$Excel.quit()
exit 0 #tested without exit, with exit and with exit 0

Header:
Qt Code:
  1. #ifndef DIALOG_H
  2. #define DIALOG_H
  3. #include <QDialog>
  4. #include <QProcess>
  5. #include <QDebug>
  6.  
  7. namespace Ui {
  8. class Dialog;
  9. }
  10.  
  11. class Dialog : public QDialog
  12. {
  13. Q_OBJECT
  14.  
  15. public:
  16. explicit Dialog(QWidget *parent = 0);
  17. ~Dialog();
  18. QProcess *proces;
  19.  
  20. private:
  21. Ui::Dialog *ui;
  22. private slots:
  23. void procFinish(int estat);
  24. void procState(QProcess::ProcessState estat);
  25. };
  26.  
  27. #endif // DIALOG_H
To copy to clipboard, switch view to plain text mode 
Source:
Qt Code:
  1. #include "dialog.h"
  2. #include "ui_dialog.h"
  3.  
  4. Dialog::Dialog(QWidget *parent) :
  5. QDialog(parent),
  6. ui(new Ui::Dialog)
  7. {
  8. ui->setupUi(this);
  9. QString program = "C:/Windows/System32/WindowsPowerShell/v1.0/powershell.exe";
  10. QStringList params;
  11. params << "-File" << "C:/Garsineu/ps_excel.ps1" << "-ent" << "C:/Garsineu/PROVAGALATEA.xls" << "-sal" << "C:/Garsineu/PROVAGALATEA.tab";
  12. proces = new QProcess();
  13. connect(proces, SIGNAL(finished(int)), this, SLOT(procFinish(int)));
  14. connect(proces, SIGNAL(stateChanged(QProcess::ProcessState)), this, SLOT(procState(QProcess::ProcessState)));
  15. proces->start(program, params);
  16. }
  17.  
  18. Dialog::~Dialog()
  19. {
  20. delete ui;
  21. }
  22.  
  23. void Dialog::procFinish(int estat)
  24. {
  25. qDebug() << "Finished";
  26. }
  27.  
  28. void Dialog::procState(QProcess::ProcessState estat)
  29. {
  30. qDebug() << estat;
  31. }
To copy to clipboard, switch view to plain text mode 
Although the conversion is successful and the states 1 (Started) and 2 (Running) are shown, the message "Finished" is never displayed.
I also tried to do it synchronously, by waitForFinished () method, which is always timed out.
The application needs to know when the process is complete, to carry out further actions on the converted file.

I appreciate your help. Thank you.