Hello! I have a problem. When I run a QProcess for the first time, my app is shown in Task Manager with all processes.
Task Manager 1.png

When I run the same QProcess second time my app dissapears from Task Manager.
Task Manager 2.jpg

When the QProcess is finished after started second time, app is shown again in Task Manager but without its process.
Task Manager 3.jpg

My code:

mainwindow.h
Qt Code:
  1. #ifndef MAINWINDOW_H
  2. #define MAINWINDOW_H
  3.  
  4. #include <QWidget>
  5. class mainWindow : public QWidget
  6. {
  7. Q_OBJECT
  8. public:
  9. mainWindow(QWidget *parent = 0);
  10. ~mainWindow();
  11. void createUI();
  12. void process();
  13. QProcess *process = new QProcess(this);
  14.  
  15. private slots:
  16. void ReadOutput(int, QProcess::ExitStatus);
  17.  
  18. };
  19. #endif // MAINWINDOW_H
To copy to clipboard, switch view to plain text mode 

mainwindow.cpp
Qt Code:
  1. #include <QWidget>
  2. #include <QPushButton>
  3. #include <QProcess>
  4. #include <QByteArray>
  5. #include <QTextCodec>
  6. #include <QString>
  7. #include <QDebug>
  8. #include "mainwindow.h"
  9.  
  10. mainWindow::mainWindow(QWidget *parent) : QWidget(parent)
  11. {
  12. createUI();
  13. connect(process, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(ReadOutput(int, QProcess::ExitStatus)));
  14. }
  15.  
  16.  
  17. mainWindow::~mainWindow()
  18. {
  19.  
  20. }
  21. void mainWindow::createUI(){
  22. QPushButton buttonsearch = new QPushButton("Start process", this);
  23. buttonsearch->setToolTip("Start process");
  24. buttonsearch->setGeometry(200, 290, 100, 30);
  25. connect(buttonsearch, &QPushButton::clicked, [this]() {process(); });
  26. }
  27.  
  28. void mainWindow::process(){
  29. process->setProcessChannelMode(QProcess::MergedChannels);
  30. process->start("\"D:\\YTDownloader\\youtube-dl.exe\" -e --no-playlist https://www.youtube.com/watch?v=6V-wwfuxZxw");
  31.  
  32. void readOutput(int exitCode, QProcess::ExitStatus exitStatus){
  33. qDebug() << exitCode;
  34. qDebug() << exitStatus;
  35. QByteArray a = process->readAllStandardOutput();
  36. QTextCodec* utfCodec = QTextCodec::codecForName("UTF-8");
  37. processStdout = utfCodec->toUnicode(a);
  38. qDebug() << processStdout;
  39. }
To copy to clipboard, switch view to plain text mode 

main.cpp
Qt Code:
  1. #include <QApplication>
  2. #include "mainwindow.h"
  3.  
  4. int main(int argl,char *argv[])
  5. {
  6. QApplication app(argl,argv);
  7.  
  8. mainWindow *window = new mainWindow();
  9. window->setWindowTitle("Test");
  10. window->setFixedSize(700, 335);
  11. window->show();
  12.  
  13. return app.exec();
  14. }
To copy to clipboard, switch view to plain text mode 

How can this be solved? Thank you!