Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QProcess not emitting any signals
QtWS25 Last Chance

QProcess not emitting any signals

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 1.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    Whuang
    wrote on last edited by
    #1

    Hello,
    I'm developing a GUI application that would execute an external command line executable. I have connected some of the signals to slots, but I find that none of the signals are emitting even though I see output from the "Application Output" window whilst debugging.

    Here's some part of my code:

    //MainWindowUi.h
    private slots:
        void process_started();
        void process_output();
    private:
        QProcess *process;
    
    //MainWindowUi.cpp
    MainWindowUi::MainWindowUi(QWidget *parent) :
        QMainWindow(parent),
        ui(new Ui::BTDProgrammerUI)
    {
        ui->setupUi(this);
    
        process = new QProcess(this);
        connect(process, SIGNAL(readyReadStandardOutput()), this, SLOT(process_output()));
    
    }
    
    void MainWindowUi::process_output()
    {
        // Not executing here
        QByteArray processOutput;
        processOutput = process->readAllStandardOutput();
        qDebug() << QString(processOutput);
    }
    

    I've tried other signals (e.g. start/finished) but they aren't being emitted as well.

    Any ideas where I went wrong?

    Thanks

    1 Reply Last reply
    0
    • W Whuang

      I started the process in a slot of a button's click signal

      process->startDetached(exe, args);
      
      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #4

      @Whuang

      I would not expect that startDetached can support all signals or if any at all.
      You can even exit the calling program and the detached application with continue to run.

      When you like to have signals transmitted you need to use start or the overloaded version.

      Vote the answer(s) that helped you to solve your issue(s)

      W 1 Reply Last reply
      3
      • Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #2

        Where do you start your executable you want to start with QProcess?

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        1 Reply Last reply
        3
        • W Offline
          W Offline
          Whuang
          wrote on last edited by Whuang
          #3

          I started the process in a slot of a button's click signal

          process->startDetached(exe, args);
          
          K 1 Reply Last reply
          0
          • W Whuang

            I started the process in a slot of a button's click signal

            process->startDetached(exe, args);
            
            K Offline
            K Offline
            koahnig
            wrote on last edited by
            #4

            @Whuang

            I would not expect that startDetached can support all signals or if any at all.
            You can even exit the calling program and the detached application with continue to run.

            When you like to have signals transmitted you need to use start or the overloaded version.

            Vote the answer(s) that helped you to solve your issue(s)

            W 1 Reply Last reply
            3
            • K koahnig

              @Whuang

              I would not expect that startDetached can support all signals or if any at all.
              You can even exit the calling program and the detached application with continue to run.

              When you like to have signals transmitted you need to use start or the overloaded version.

              W Offline
              W Offline
              Whuang
              wrote on last edited by
              #5

              @koahnig Thank you that was the reason why

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved