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
5
votes
1 answer

Proper usage of QProcess

Platform: Qt 4.8.2, Win 7 Please consider the following logic flow: 1. App started 2. functionA() triggered 3. the app periodically capture some images to external files 4. end of functionA() 5. the app create a video from captured images, using…
YamHon.CHAN
  • 866
  • 4
  • 20
  • 36
5
votes
2 answers

QProcess and command line "/c" argument

I have very strange problem with QProcess and it's strange behaviour. What i wanna get at the end is something like this (this is cmd.exe in windows 7) C:\path_to_somewhere>cmd /c "C:\Program Files\path_to_dir\executable" (cmd is for compatibility…
Jakub Chromiak
  • 593
  • 1
  • 5
  • 15
5
votes
1 answer

QProcess start with files from stdin and stdout

I need to run following statement from QProcess: programm < file1 > file2 in QT: QProcess *proc = new QProcess; proc->setReadChannelMode(QProcess::SeparateChannels); proc->start("program < \"file1\" > \"file2\"", QIODevice::ReadWrite); But somehow…
Oliver
  • 2,864
  • 1
  • 16
  • 27
5
votes
2 answers

How do I get the output of a command run by QProcess in PySide?

I would like to know how I can capture the output of a command run by QProcess in PySide so that it can be displayed.
polandeer
  • 396
  • 4
  • 16
4
votes
2 answers

How to use a process (QProcess) in a new thread (QThread)?

I have the following code: void Processmethod() { QDialog *ProcessMessage = new QDialog; Ui::DialogProcessMessage Dialog; Dialog.setupUi(ProcessMessage); ProcessMessage->setModal(true); …
Streight
  • 811
  • 4
  • 15
  • 28
4
votes
1 answer

How to get the error code from a QProcess?

I have a function A() in which I execute eight other 'sub-functions' which all include a QProcess. How do I get the return codes from all the QProcesses? Example: void Mainclass::A() { B(); C(); // ... I(); } void Mainclass::B() { …
Streight
  • 811
  • 4
  • 15
  • 28
4
votes
0 answers

Why do QProcess (Qt 5.15.1) and GDB lead to missing symbols?

I am currently having some trouble debugging a program that starts processes via QProcess. Simply executing the binary without dbg works just fine but when I try to debug the executable with gdb I am getting a SIGTRAP when the process has…
Elias
  • 41
  • 3
4
votes
4 answers

How to launch a QProcess with root rights?

I need to launch gphoto2 from a Qt program. I do this: QString gphotoProgram = "/usr/bin/gphoto2"; QStringList gphotoArguments; gphotoArguments << "--capture-image"; QProcess *gphotoProcess = new QProcess(this); gphotoProcess->start(gphotoProgram,…
Stéphane Péchard
  • 2,013
  • 3
  • 22
  • 35
4
votes
1 answer

How do I queue QProcesses in PyQt5?

I want to queue QProcess in PyQt5 or simply block while still reading the stdout with readAll(). The equivalent of subprocess.call instead of subprocess.Pop. When using waitForFinished() the stdout with readAll() will all come at once when the…
Damuno
  • 161
  • 1
  • 11
4
votes
3 answers

Set Environment Variables for startDetached() QProcess

In Qt4, there is QProcess::setProcessEnvironment() for setting Env variables for the newly spawn process. However, QProcess::startDetached() is a static member function, so setProcessEnvironment() doesn't apply. How does one set Env variables for a…
Shen Chen
  • 123
  • 2
  • 6
4
votes
2 answers

Qt - QProcess is not working

I try to launch internet explorer, So I use the below code QProcess * process=new QProcess(this); QString temp="C:\\Program Files\\Internet\ Explorer\\iexplore.exe"; process->startDetached(temp.toStdString().c_str()); But it doesn't work.
prabhakaran
  • 5,126
  • 17
  • 71
  • 107
4
votes
1 answer

aplay does not play audio when run by systemd

I'm developing a Qt application which includes the following block of code to play sound QString soundApp = "/usr/bin/aplay"; QStringList soundFile; soundFile << "/home/pi/urna-files/sources/som-longo.wav"; QProcess *playSound = new…
4
votes
1 answer

Suspend and resume a sub-process started by QProcess in Qt

How can I suspend and resume a subprocess that I started as a QProcess in Qt? Is there a Qt function for that, or if not, a platform-specific one that would work on Linux?
sashoalm
  • 75,001
  • 122
  • 434
  • 781
4
votes
2 answers

Start QProcess from within QDialog that is used as a progress monitor

I have a main pyqt program that needs to run external program with arguments. I would like to use a QDialog as a sort of a status monitor that would capture the external program's stdout while it is executing and display them in a textbox inside the…
For Comment
  • 1,139
  • 4
  • 13
  • 25
4
votes
1 answer

pointer to QProcess object in class constructor crashes qt GUI

I have a qt GUI application which contains a widget DS9 derived from a QFrame, for opening and operating with an external program. The implementation of the class looks like this: ds9.h #ifndef DS9_H #define DS9_H #include #include…
Jerry Ma
  • 511
  • 4
  • 15
1 2
3
44 45