Questions tagged [qprocess]

The QProcess class, part of the Qt framework, provides a way to start external programs and to communicate with them.

The QProcess class is used to start external programs and to communicate with them.

To start a process, pass the name and command line arguments of the program you want to run as arguments to start(). Arguments are supplied as individual strings in a QStringList.

Alternatively, you can set the program to run with setProgram() and setArguments(), and then call start() or open().

The official Qt documentation can be found here for Qt 4.8 and here for Qt 5.

675 questions
3
votes
0 answers

Is QProcess::finished signal called when the process is killed?

As the title says, do you know if a killed process in Qt calls the finished signal? From the docs finished and kill is not clear to me. Even if I could do a test, I would like to know an official answer, so that I am sure the behaviour is the same…
n3mo
  • 663
  • 8
  • 23
3
votes
1 answer

Reliable detection of QProcess finishing

I have a Windows Qt application that uses QProcess to run an external program which may or may not need input. The input will always be y followed by ENTER if needed. And, if y is entered, the program exits immediately. So the actions I take in the…
paxdiablo
  • 854,327
  • 234
  • 1,573
  • 1,953
3
votes
1 answer

How to stop running PyQt5 program without closing the GUI window?

The following code pings a website and prints the result in QTextEdit. One button "Run" is used to start the ping. I want to have another button "End", which could stop the ping process while it is running without closing the GUI. But currently, the…
user20726
  • 77
  • 2
  • 7
3
votes
1 answer

PyQt Cannot Read Stdout from QProcess Program

The app is a GUI wrapper for a Windows command line program. A button starBbtn creates a new process that runs the CLI program. The output from the CLI program is printed into a QTextEdit. Problem: Nothing from the CLI output appears to be inserted…
Nyxynyx
  • 61,411
  • 155
  • 482
  • 830
3
votes
3 answers

How to check if a program exists in path using Qt?

I have this code: QProcess* proceso = new QProcess(); QString programa = "unknow -v"; proceso->start(programa); proceso->waitForFinished(); QString normal = proceso->readAllStandardOutput(); QString errores =…
Omar Murcia
  • 547
  • 2
  • 11
  • 26
3
votes
1 answer

reading and writing to QProcess in Qt Console Application

Noted: this appears to be a specific issue question but hopefully it can be edited for all to related to I need to interact with a QProcess object. The Problem: I am not getting any output from QProcess after calling QProcess:write(input) More…
CybeX
  • 2,060
  • 3
  • 48
  • 115
3
votes
1 answer

Ampersand(&) (very command execute) with QProcess

I'm using Qt and tcsh over it, need to execute something like: tcsh: pwd & ls in Qt: QString cmd = "pwd & ls"; QProcess *process = new QProcess; process->start(cmd); process->waitForBytesWritten(); process->waitForFinished(); qDebug() <<…
elif mutlu
  • 83
  • 5
3
votes
1 answer

How to run a detached application by terminal command in Qt application?

I want to use commands: cd /opencv/opencv-3.0.0-alpha/samples/cpp/ ./cpp-example-facedetect lena.jpg to run a sample code of OpenCV on clicked() method of button in Qt application. So I use: void MainWindow::on_btSample_clicked() { …
My Will
  • 400
  • 4
  • 27
3
votes
0 answers

Attached child QProcess outliving parent

I have a Qt application (Qt 5.5) that is launching from a usb drive on windows. In main I am using QProcess::start (NOT QProcess::startDetached) to start a new process. When killing the parent the child lives on and is functioning normally. The…
3
votes
1 answer

How to start detached process and wait for the parent to terminate?

Using QProcess to implement an updater I start a detached process from my application and immediately exit. In the spawned updater process I will overwrite the files as needed and then start the main app again. The problem is that the update of the…
Resurrection
  • 3,916
  • 2
  • 34
  • 56
3
votes
1 answer

When using pyqt on Windows, what does the QProcess.pid() result represent?

The documentation for QProcess.pid() says: Returns the native process identifier for the running process, if available. If no process is currently running, 0 is returned. What does this mean? This code is used to explain my confusion. I am using…
Andy
  • 49,085
  • 60
  • 166
  • 233
3
votes
1 answer

QProcess always returns -2 when running a valid command

I am writing a program in qt that will execute commands in windows. Here is the method I am using to try to get the commands to work. bool FirmwareUpdater::RunCommand( QString& command, QStringList& args, int expectedCode ) { QProcess *proc =…
Snhp9
  • 511
  • 1
  • 6
  • 21
3
votes
1 answer

Using QProcess.finished() in Python 3 and PyQt

How can I use the QProcess.finished() to call a different Python3 script. Here's the script I call: #!/usr/bin/python from PyQt4.QtGui import QApplication from childcontrolgui import childcontrolgui def main(): import sys app =…
Otmarius
  • 31
  • 1
  • 4
3
votes
2 answers

How to stop a detached process in qt?

After starting a process with QProcess::startDetached, how can I stop it later? Say the main program runs, then starts the detached process, which runs independently. The user closes the main program, then later opens it up again and wants to stop…
JVE999
  • 3,327
  • 10
  • 54
  • 89
3
votes
2 answers

How to execute a php script in Qt?

this->getMined.start("php", QStringList() << "get_cexio_BTC.php"); this->getMined.waitForFinished(); QByteArray output = getMined.readAll(); output: "Could not open input file: get_cexio_BTC.php\n" Project files and get_cexio_BTC.php are in the…
Kamil Pajak
  • 340
  • 2
  • 13