简体   繁体   English

QT Creator QProcess

[英]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. 我想运行一个Fortran可执行文件,当我在创建的界面中单击按钮时会调用该可执行文件。

Although when I click in the button nothing happens. 虽然当我单击按钮时没有任何反应。 Here is the code: 这是代码:

QProcess *process = new QProcess(this);
QString program = QDir::currentPath() + "/PARROT/Console1.exe";
process->start(program);

The string is in that way because I want to be capable of changing the path to the main executable and the fortran executable. 字符串之所以这样,是因为我希望能够更改主可执行文件和fortran可执行文件的路径。

What I'm doing wrong? 我做错了什么?

Check this link - QProcess Start command syntax 检查此链接-QProcess Start命令语法

syntax - void QProcess::start(const QString & program, const QStringList & arguments, OpenMode mode = ReadWrite) 语法-void QProcess :: start(const QString&program,const QStringList&arguments,OpenMode mode = ReadWrite)

You need to pass the argumentlist as 2nd parameter,along with the process path as 1st parameter, needed to start the process. 您需要将参数列表作为第二个参数传递,并将进程路径作为第一个参数传递,以启动进程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM