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
2 answers

Using undo stack for a command which is running asynchronously and is emitting signals

I have a command inherited from QUndoCommand: class ImportEntityCommand : public QUndoCommand { // ... private: QString m_importedEntityName; Importer *m_importer; // ... } The redo method kicks off a QProcess: void…
Megidd
  • 7,089
  • 6
  • 65
  • 142
2
votes
1 answer

How to start explorer.exe with QProcess when the path to the specified file contains spaces?

I want to start explorer and select a specific file. So I run QProcess::startDetached(command); with command set to explorer.exe /select,C:\Users\....\file.txt This works fine, but will fail if the path to the file contains spaces. But if I put…
MiB_Coder
  • 865
  • 1
  • 7
  • 20
2
votes
1 answer

How to get INT variable to QProcess write command?

Following code works QProcess *p = new QProcess(); p->write("10 cats\n"); Now I need to send int variable to write command. Something like: QProcess *p = new QProcess(); int i = 10; p->write(i << " cats\n");
user9066046
  • 87
  • 1
  • 10
2
votes
2 answers

Run command with PyQt5 and getting the stdout and stderr

I want to run command with PyQt5. And I want to get the stdout and stderr in time order and in real-time. I separated into UI class and Worker class. There are several UI classes, but for simplicity, I've specified just one. I've tried to solve this…
HoYa
  • 324
  • 3
  • 17
2
votes
1 answer

QProcess:exitCode() does not appear to return %errorlevel%

I am trying to catch specific error codes from a windows command line application run as a QProcess. I had an error today where the application fails: When run on the command line: echo %errorleve% returns 14001 (ERROR_SXS_CANT_GEN_ACTCTX) which is…
gollumullog
  • 1,249
  • 2
  • 14
  • 22
2
votes
2 answers

Reading binary data with PySerial from serial port

PyQT 4.7 does not have inherited class from QIODevice that allows to talk with serial port directly (e.g. QSerialDevice). So I thought that it would be easier for me to use QProcess class and implement the actual reading/writing to serial port from…
user389238
  • 1,656
  • 3
  • 19
  • 40
2
votes
1 answer

How to read QProcess output

In the main thread of a Gui Application I am starting a QProcess of another GUI application that will log some messages over time in stdout using fputs(). The problem is that after some time the GUI application started with QProcess will freeze…
2
votes
0 answers

Using QProcess to start and stop a python script in a virtual environment

I am attempting to run a python script from a QT application. This script need to to be run inside a virtualenv called venv. I can start the script but when I attempt .kill() the script will keep running until the console window is closed.…
quesyKing
  • 148
  • 7
2
votes
1 answer

Use QProcess to send EndOfText (Ctrl-C) to interactive shell

I use a QProcess to open /bin/sh or /usr/bin/bash and it's possible to write commands to the shell and read the output into my program. The actual problem occurs when trying to send a end-of-text control signal to the shell to abort the running…
0xpentix
  • 732
  • 9
  • 22
2
votes
1 answer

QProcess does not work

I have the following code: const char* argument = string1.c_str(); QString arg(argument); QProcess *proc = new QProcess(this); proc->start(arg); The value of string1 is: ps -ef | grep "./scriptTest" | grep -v grep | awk…
Eric Bautista
  • 403
  • 3
  • 8
  • 18
2
votes
1 answer

QProcess exit normally

I'm using python with qt and i cannot find out a way to fire a signal when Qprocess exit normally, According to Pyqt documentation finished() signal can take 2 arguments exitCode and exitStatus This is what Pyqt documentation says about finished()…
Mohamed sayed
  • 23
  • 1
  • 6
2
votes
1 answer

Trying to get QProcess to work with a queue

I am trying to run several processes with a queue and get the output for all processes using QProcess but I am having a couple of issues. I am using a QSpinBox to set the max processes to run at the same time and I can get everything working fine in…
Richard
  • 445
  • 1
  • 5
  • 21
2
votes
1 answer

Embedding a terminal in PyQt5

So I've been trying to create my own terminal but that has been proven very glitchy and not professional looking. Then I stumbled across this code which is for PyQt4: #!/usr/bin/env python #-*- coding:utf-8 -*- import sys from PyQt4.QtCore import…
user8513021
2
votes
1 answer

readyReadStandardOutput signal does not work

I'm trying to get stdout output from the child process using the PyQt5 QProcess class. If I use waitForFinished(), QMainWindow is frozen. But the signal readyReadStandardOutput does not work, although the process is started. Here is my…
user9368165
2
votes
1 answer

PyQt: Multiple QProcess and output

I have a PyQt window that calls multiple executables as QProcess. How can I list the outputs of each process after the last one has finished? (something like process_result = ["result1", "result2",..]) Let us say it looks like this: for i in…
C Winkler
  • 161
  • 2
  • 15