Important: Please read the Qt Code of Conduct -

Try to get qprocess output

  • Hi everyone!
    I have been working on running simple pyhton code when button is clicked. Here is the thing that I wanted to ask is;
    When I clicked the button, nothing happends. The pyton code is very simple it is just typing 'Hello!'. When I clicked the button, the terminal has to open or not? How can I get the 'Hello' output?

        connect(ui->deneme, &QPushButton::clicked,this, &MainWindow::startProcess);
    void MainWindow::startProcess(){
        QProcess process;

    The following is the pyhton code;


    Thanks for your help in advance!

  • @gizalp
    Why do you think python (or anything else) is going to open any terminal window? And what OS are you on anyway?

    For QProcess:setProgram you should have process.setProgram("python");, only. But in this case I think it's getting overridden by your process.start("python"); so it doesn't matter, but it's wrong.

    If you want to grab a sub-process's output, you have to handle QProcess::readyReadStandardOutput(), and in there something like QByteArray QProcess::readAllStandardOutput(), if that's what you mean by "How can I get the 'Hello' output?".

    How this relates to Trying to implement thumbnail list I have no idea....