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

Running external executable in Qt using QProcess

I'm trying to run an external executable (code below) in Qt as a separate process. test.c: #include int main () { FILE *f; f = fopen("a.txt", "w"); fprintf(f, "1\n"); fclose(f); return 1; } and in Qt I have: QProcess*…
sbru
  • 877
  • 6
  • 21
  • 36
0
votes
1 answer

QT Creator QProcess

I want to run a fortran executable that is called when I click in push button in the interface that I created. Although when I click in the button nothing happens. Here is the code: QProcess *process = new QProcess(this); QString program =…
0
votes
2 answers

Why is QProcess converting the '=' in my arguments to spaces

I've run into a weird error with a Qt program running on Windows. The program uses QProcess to spawn a child process wit two arguments. The program and arguments passed to the QProcess::start() method are of the form: "batchfile.bat"…
dagorym
  • 5,695
  • 3
  • 25
  • 23
0
votes
1 answer

QDir::remove() always causing a crash when called in specific SLOT

Everytime I call QDir::removeRecursively() my application crashes AFTER having removed the folder containing the files correctly. Having done some testing I found out that it depends on how I call the function. This is my…
testus
  • 183
  • 2
  • 21
0
votes
0 answers

How to call a slot, that belongs to a QThread, within that same QThread?

I have a QThread that starts an external Linux binary. I use connect() to call a slot(), which is part of the QThread, whenever I get an output from that external Linux binary. This seems not to work for me. Can anyone tell me what is wrong in the…
jxgn
  • 741
  • 2
  • 15
  • 36
0
votes
2 answers

QProcess preventing UI updates

I'm writing a program that enables the WLAN drivers on a device, and then searches for local Wi-Fi connections. Turning on the drivers and performing the scan are done using the command line with QProcess. This all works fine; the problem is that…
Churchbus
  • 53
  • 5
0
votes
1 answer

QProcess not starting

I have following code: proc = new QProcess(); proc->startDetached("C:\\ffmpeg.exe", QStringList() <<"-i"<< "C:\\pics\\frame%d.png"<< "-r"<< "30" << "-vcodec"<< "ffv1" << "C:\\test.avi"…
testus
  • 183
  • 2
  • 21
0
votes
1 answer

How to start and stop an external program in another device using Qt?

I'm developing a firmware updater that should download data from a web server and upload it to an Embedded Linux device. I want a program (client) to start another program (server) before establishing a connection between them and start sending the…
Momergil
  • 2,213
  • 5
  • 29
  • 59
0
votes
1 answer

Write command to gnome terminal with QProcess

I am trying to write an application with Qt in Netbeans. I am able to open the gnome terminal (in Ubuntu), however I can't seem to get a command to be executed in the terminal once it is open, e.g. to execute the 'ls' command. Can anyone perhaps…
user1145581
  • 1,017
  • 4
  • 13
  • 18
0
votes
1 answer

trouble passing parameters to console application

I have trouble with correctly launching cloc 1.62 from windows command line using qprocess. Here is what i have: A QStringList with all the languages cloc recognizes; QStringList…
0
votes
0 answers

Reading STDIN with read() is being blocked when app is open by another using QProcess

I have the following situation: two applications, "interface" (Qt) and "center" (C), work together as part of a embedded Linux solution communicating mainly by sockets. "Interface" starts "center" and must be able to send a "close" command to it.…
Momergil
  • 2,213
  • 5
  • 29
  • 59
0
votes
1 answer

Isn't the line QProcess *p redundant?

I've stumbled across this GitHub Project. While I don't agree with the code in general I can't wrap my mind about the line: QProcess *p; and p=*it; Am I wrong when I feel like creating a new pointer there is completely redundant or is there some…
deW1
  • 5,562
  • 10
  • 38
  • 54
0
votes
1 answer

Starting 7zip from QProcess gives error "cannot find archive"

i am working on an application made with Qt5 that downloads a .zip-file to a temporary directory and extracts the .zip-file to a specified directory. I already managed to download the .zip-file and now I'm trying to extract it using 7zip. I use…
jsf
  • 913
  • 3
  • 14
  • 22
0
votes
0 answers

QProcess Live Output Redirection

I'm trying to redirect the output of QProcess live into my console. Here is the code I'm using: QProcess *process = new QProcess(this); connect (process, SIGNAL(readyReadStandardOutput()), this, SLOT(processOutput())); connect (process,…
sundar
  • 456
  • 2
  • 7
  • 19
0
votes
0 answers

QProcess.write to python script failed

I use Qt4 QProcess to run one python3.4 script in new QThread. I want to input something to the script while it is still running. But every time I write, the program has unexpectedly finished, and the python script is still running background. Don't…
circleone
  • 75
  • 1
  • 7