Quote Originally Posted by ChristianEhrlicher View Post
Can you please show us your code?
Yes, of course.

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

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