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

QProcess, QEventLoop - of any use for parallel-processing

I wonder whether I could use QEventLoop (QProcess?) to parallelize multiple calls to same function with Qt. What is precisely the difference with QtConcurrent or QThread? What is a process and an event loop more precisely? I read that…
kiriloff
  • 25,609
  • 37
  • 148
  • 229
0
votes
1 answer

Set text in QTextBrowser with a QString that includes QProcess enums

I want to write a QString that includes two QProcess enums into a QTextBrowser. Therefore I used in one of my methods: QString Text = "Error! Exit-Status: " + Status + QString(" Error-Code: ") + Prozess.error() + " File not…
Streight
  • 811
  • 4
  • 15
  • 28
-1
votes
1 answer

Qt QProcess::execute command, in Windows cmd.exe, gives -2 exit code

I'm trying to invoke the Windows On-Screen Keyboard with the command: C:\Windows\System32\osk.exe Running this command from Windows cmd.exe works perfectly fine. But when I run from with the Qt application int exitCode = QProcess::execute(…
TenG
  • 3,843
  • 2
  • 25
  • 42
-1
votes
3 answers

double quotes problems in Qstring

QProcess p; QString aa = "tasklist /FI 'IMAGENAME x32dbg.exe' /FO LIST | findstr 'PID:'"; aa.replace(0x27,0x22); qInfo() << aa; p.start(aa.toStdString().c_str()); p.waitForFinished(); qInfo() << "Output:" << p.readAllStandardOutput() << "Error:" <<…
-1
votes
2 answers

QProcess won't start process on Windows (but works on Linux and OSX)

I am currently working on a signal analyzing program with a GUI, which should run on Linux, OSX and Windows. For some reason this program won't run on Windows, but I don't get any Error Messages. More precisely my main program (GUI) fails to spawn…
Dost
  • 1
  • 2
-1
votes
1 answer

Get the current macOS shell using Qt

According to this I can get it using this command: dscl . -read ~/ UserShell So, I wrote this code using Qt: QProcess p; p.setProcessChannelMode(QProcess::MergedChannels); p.start("dscl", QStringList() << "." << "-read" << "~/" <<…
Alexander Dyagilev
  • 1,139
  • 1
  • 15
  • 43
-1
votes
1 answer

QProcess.start doesn't return exit status nor exit code

Im currently using QProcess to run Linux commands from a C++ app and I'm having a strange behavior when using QProcess::start function. This minimal example illustrates that even if the process fails, the process exit status is considered to be…
Arkaik
  • 852
  • 2
  • 19
  • 39
-1
votes
2 answers

Re-running the python script after using it QProcess

I want to queue QProcess in PyQt5 according to the spinBox value, as well as display text in textEdit using readAll (), but whatever value I specify in spinBox, the script runs only 1 time, and its result is not displayed in textEdit. Please tell me…
-1
votes
1 answer

Using QProcess to call an external program, with arguments

I have a exe folder located in one folder, and then all of my config files in another. In order to run the program: I need to direct the terminal to the config file folder Then run the exe folder, with arguments. Shown below, I have this working…
-1
votes
1 answer

Getting error level of a bat file when running it from Python

I have a .bat file that calls different things and runs different scripts to compile and build a system developed by other programmers. I am trying to call that .bat file from Python using Qprocess. The bat file runs smoothly. However, if the bat…
Payam30
  • 689
  • 1
  • 5
  • 20
-1
votes
1 answer

How to initialize Objects in a QList in a loop

In My class I have a member variable; QProcess* p1; Inside some function, i initialize and use it as: process1 = new QProcess(); it works fine. Now i have a situation where i have many of these processes to be started. One option is to declare all…
-1
votes
1 answer

How to set an argument to run a class file using QProcess?

I was wondering if there is a way to use QProcess to start the main.cpp of another class to enter into its execution as such QProcess *myProcessA = new QProcess(); myProcessA->start("*Anotherclass*main.cpp"); I can start applications and other…
OlaB
  • 176
  • 11
-1
votes
2 answers

How to open a console window for started process under Linux in Qt?

I use QProcess to open a console window but no window is shown. QProcess *process = new QProcess(); process->startDetached(command); I want to open a window to start a text-mode command, e.g. adb -s xxxxx shell to open a shell window to access an…
kien bui
  • 1,760
  • 2
  • 17
  • 33
-1
votes
2 answers

User Input with QT Widget Application

I have a QT widget that is functioning as a GUI for an external Process I am running. I am manually setting the path for this executable in the code. I would like to allow for the user to specify the path to the executable, from the GUI. My idea was…
Gage Haas
  • 51
  • 1
  • 2
  • 8
-1
votes
2 answers

Sending SIGINT to QProcess

I want to send SIGINT to a program started using QProcess. I am working on ubuntu. Source code of my process looks like this: #include #include #include #include void int_handle(int sig) { …
mkreddy
  • 163
  • 3
  • 5
  • 12
1 2 3
44
45