qprocess

Using QProcess to read standard output

流过昼夜 提交于 2020-07-09 14:33:09
问题 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 of the program is redirected via the standard output to a text file. I am attempting to use QProcess to open and run this shellscript, then read the standard output that is being used to print the result of the C++ program to the text file. The

Using QProcess to read standard output

允我心安 提交于 2020-07-09 14:29:09
问题 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 of the program is redirected via the standard output to a text file. I am attempting to use QProcess to open and run this shellscript, then read the standard output that is being used to print the result of the C++ program to the text file. The

How to stop running PyQt5 program without closing the GUI window?

*爱你&永不变心* 提交于 2020-06-27 16:23:29
问题 The following code pings a website and prints the result in QTextEdit. One button "Run" is used to start the ping. I want to have another button "End", which could stop the ping process while it is running without closing the GUI. But currently, the "End" button closes the whole GUI window. Do you have any thoughts on how to stop the ping but keep the GUI, so I can start the ping again by pressing the "Run" button. import sys from PyQt5 import QtCore,QtWidgets class gui(QtWidgets.QMainWindow)

Checking whether qprocess has finished

巧了我就是萌 提交于 2020-05-18 12:04:49
问题 I have to check whether my process has finished and I need to convert it to bool because I want to you if. In MainWindow.h I have created an object QProcess *action; In mainwindow.cpp void MainWindow:: shutdown() { action=new QProcess(this); action->start("shutdown -s -t 600"); //and now I want to use if if (action has finished) { QMessageBox msgBox; msgBox.setText("Your computer will shutdown in 1 minute."); msgBox.exec(); } 回答1: You should connect to the process's finished signal. Your code