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

How to pass command line arguments verbatim to a QProcess?

How does one pass the command line arguments of the current process to a QProcess, ideally avoiding any conversions? I.e. whatever "junk" was passed to the current process is supposed to be passed to the sub-process, without the fallout of…
Kuba hasn't forgotten Monica
  • 95,931
  • 16
  • 151
  • 313
2
votes
3 answers

Get Output in Qt: 'QProcess::start()' and 'QProcess:readAllStandardOutPut()'

Platform:Windows10 I use QProcess::start execute the Python file(in same diretory),but i can't get results from readAllStandardOutput function. Python file code : test.py print “hello,world” Qt: #include #include #include…
nick
  • 63
  • 1
  • 6
2
votes
1 answer

QProcess read and write

I am trying to read and write from a qprocess right now. I made a little test program that takes input and redisplays it on the screen in a loop. Here is my code from Qt QString path = "./test"; tcd = new QProcess(this); …
CasualScience
  • 661
  • 1
  • 8
  • 19
2
votes
2 answers

How to communicate Qt applications two-way

I want to create two-way communicate beetwen my Qt Apps. I want to use QProcess to do this. I'm calling sucesfully child app from root app and sending test data without any erro, but I can't recive any data in child app. I'll be gratefull for any…
kluszon
  • 375
  • 5
  • 19
2
votes
2 answers

Using QProcess to read standard output

In my QT widget application I am attempting to run a shellscript that opens a C++ program and provides inputs to the program as well. The program starts a command prompt that requires the users input to start. Once the program is started the output…
Gage Haas
  • 51
  • 1
  • 2
  • 8
2
votes
0 answers

QProcess not accepting arguments in MacOS

Running Qt5.10 on MacOS 10.13.2 I am trying to open photoshop with one or more selected images in MacOS. In terminal this works: open "/Users/roryhill/Pictures/4K/2017-01-25_0030-Edit.jpg" -a "Adobe Photoshop CS6" The following works in Windows…
Rory
  • 113
  • 8
2
votes
1 answer

Getting the executable name of a QProcess in Qt/C++

Is there any possibility to figure out the executable name/path of a QProcess object? By now I only know that there is QProcess::pid() for identifying a process. Scouring the Qt doc hasn't lead to a useful solution so far. Thanks in…
tai
  • 477
  • 1
  • 5
  • 16
2
votes
1 answer

Read stdoutput of continuous QProcess in Qt

I am having some problem regarding QProcess using Qt. I have connected the following function with the onClick event of a push button. Basically, I want to execute another file when this button is clicked, and get its output on my Qt program. This…
Daud
  • 21
  • 2
2
votes
1 answer

QProcess::finished ( int exitCode, QProcess::ExitStatus exitStatus ) :possible values of exitcode?

I am using QProcess to execute shell commands. How can I determine that command is executed successfully ? ExitStatus tells that process exited normally or crashed. What are the possible values of exitcode ? I am getting variant exitcode for…
Ashish
  • 8,441
  • 12
  • 55
  • 92
2
votes
4 answers

QProcess will not open python script

I cannot figure out why this does not work: void Controller::on_buttonVisualTracking_clicked() { QProcess *trackingProcess = new QProcess(); trackingProcess->start("python C:\\visualTracking.py"); } The specific script here is a pychart…
granitdev
  • 136
  • 2
  • 13
2
votes
2 answers

QProcess with 'cmd' command does not result in command-line window

I am porting code from MinGW to MSVC2013/MSVC2015 and found a problem. QProcess process; QString program = "cmd.exe"; QStringList arguments = QStringList() << "/K" << "python.exe"; process.startDetached(program, arguments); When I use MinGW, this…
DarkSidds
  • 164
  • 11
2
votes
2 answers

Redirecting the output of QProcess when running a resource file

fairly new to Qt. I'm using QProcess to run an external shell script and redirecting the output to a textBrowser on my GUI. Code: In mainwindow.h: private: QProcess *myProcess; and mainwindow.cpp: void MainWindow::onButtonPressed(){ myProcess…
Sphics
  • 88
  • 1
  • 9
2
votes
1 answer

How to parse pacmd list output and find sink indexes and names using QRegExp?

Normally from the terminal I use the command: pacmd list-sinks|awk '/index:/ {print $0} /name:/ {print $0};' which gives me an output like this: index: 0 name: index: 1 name:…
the_naive
  • 2,936
  • 6
  • 39
  • 68
2
votes
2 answers

List of variable contents with linux echo command Run with qtProcess

I want to do the "echo" command, which is used to show the variable content in the linux terminal, using the GUI. I wrote this using qProcess, but it only printed $SHELL as output. QString cmd = "echo $SHELL"; QProcess *process = new…
elif mutlu
  • 83
  • 5
2
votes
1 answer

QProcess:execute blocks entire application

In my application I use the following code to create new threads and execute an external application in those threads: int main(int argc, char *argv[]) { ... WebSocketServer *server = new WebSocketServer(); QObject::connect(server,…
HansHupe
  • 476
  • 3
  • 13