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

How can I know when QProcess wants to read input?

I'm implementing a compiler in my Compilers class, I'm using Qt & C++. After I have generated the machine code from the source code, I'm executing the virtual machine that will execute the code. I'm facing a problem here, I'm using readyRead()…
mpcabd
  • 1,813
  • 15
  • 20
4
votes
1 answer

Qt avoid warning 'QProcess: destroyed while process still running

Simplest code: void test { QProcess p; p.start("sleep 10"); p.waitForBytesWritten(); p.waitForFinished(1); } Of course, the process can't be finished before the end of the function, so it displays a warning message: QProcess:…
Konstantin Ivanov
  • 245
  • 1
  • 3
  • 6
4
votes
0 answers

QProcess not work with start but work with startDetached

I have a problem with start dos application with Qprocess::start. #include #include int main(int argc, char *argv[]) { QApplication a(argc, argv); QProcess *process = new QProcess(); …
4
votes
2 answers

How do I read from QProcess?

I have this simple C++ program: int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); QProcess ps; QByteArray ba; ps.start("ls J:"); ba = ps.readAllStandardOutput(); char *someData = ba.data(); cout <<…
Amani
  • 16,245
  • 29
  • 103
  • 153
4
votes
1 answer

Run ffmpeg on Terminal MacOS

I'm rather new to MacOS and I cannot find it easy to working with Terminal to get ffmpeg run properly as I have on Window. I have got ffmpeg binary from http://ffmpegmac.net and I try running the executable in Terminal, it tells that the command not…
user2139175
  • 61
  • 1
  • 1
  • 5
4
votes
1 answer

Redirecting output from gnome-terminal using QProcess in C++

I am trying to generate a subprocess for a gui which will spawn a terminal. I want the data produced by this terminal (stdout and stderr) to be displayed on the window that appears as well as to a set log file. When I type the command directly in to…
ElCraneo
  • 495
  • 1
  • 6
  • 11
4
votes
2 answers

QProcess cannot write to cmd.exe

I cannot seem to get QProcess to pass commands to cmd.exe via stdin. I have tried other command line apps as well. Here is some simple code that I use to try and debug: prog = "c:/windows/system32/cmd.exe" arg = [""] p = QtCore.QProcess() retval =…
user1837845
  • 41
  • 1
  • 2
4
votes
1 answer

Qt: can't launch Windows console with QProcess

QProcess simply doesn't display the black console window. This is the code I use: QProcess*p=new QProcess(this); p->start("cmd.exe"); Replacing cmd.exe with calc.exe successfully launches the calculator.
Alex
  • 34,581
  • 26
  • 91
  • 135
4
votes
1 answer

Real time display of QProcess output in a textBrowser

I am a newbie in qt development and i want to transfer the output of QProcess to a textBrowser in real time. I started by executing a simple echo command,but the output of the program is not getting displayed. What am i doing wrong???? QProcess…
Tanmay J Shetty
  • 197
  • 2
  • 3
  • 9
3
votes
4 answers

Qprocess messes my linux command up (i think). how to fix?

I need to force my c++ QT4 application to read results from a linux command. I am trying to use Qprocess but as soon as my command gets complicated it get messed somehow (just guessing) and does not work. Here i try to make for yu a small…
Stefano
  • 3,981
  • 8
  • 36
  • 66
3
votes
1 answer

QProcess does not properly trigger executable .sh

Probelm: I have been trying to run an executable file using QProcess triggering the executable file using a QPushButton and showing the whole result of the output on QTextEdit but without success. *The error: I don't see the whole output despite,…
EsoMars
  • 337
  • 3
  • 14
3
votes
2 answers

QProcess becomes defunct and unable to start again

I'm using a List of QProcess objects to keep track of some processes that need to be start/stopped at user defined intervals. I'm able to start and stop the processes OK. But the issue arises when I stop a process using the following methods (Pseudo…
Chase Henslee
  • 3,918
  • 1
  • 18
  • 21
3
votes
1 answer

QProcess and QLocalSocket - IPC messages aren't received

Following the Fortune Client example. Have a subclass of QLocalServer which starts the another application (client) using the Qprocess and this client will send some messages using the QLocalSocket. Only the first message from the client appears in…
ramtheconqueror
  • 1,907
  • 1
  • 22
  • 35
3
votes
2 answers

In-app kernel extension unloading/loading on Mac OS

I need to unload a bunch of driver (kext) at the beginning of my Qt Desktop application on Mac OS. I tried with QProcess, but kextunload requires to have admin privileges. Anyone knows a workaround? Or how to start a QProcess with sudo? I need this…
AloyseTech
  • 41
  • 4
3
votes
1 answer

Qt how to open Device Manager

I am trying to open device manager from a button on Qt Windows app. What I tried: Assigned the slot/signal to the button. And the method: QProcess *proc = new QProcess(this); QString cmdStr = "devmgmt.msc"; proc->start(cmdStr); qDebug()…
GeneCode
  • 7,545
  • 8
  • 50
  • 85