How to run a system command in Qt?

前端 未结 2 1666
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-24 01:50

I have to run a system command in Qt. but I have to give an argument for that command.

for example opening gedit with a text file. like \"gedit /home/oDx/Documents/

相关标签:
2条回答
  • 2020-12-24 02:20

    QProcess::execute() may be helpful:

    QProcess::execute("gedit /home/oDx/Documents/a.txt"));
    
    0 讨论(0)
  • 2020-12-24 02:24
    QProcess process;
    process.start("gedit", QStringList() << docPath);
    

    the same as above

    QProcess process;
    process.start("gedit", QStringList() << "/home/oDx/Documents/a.txt");
    

    Also, read this.

    0 讨论(0)
提交回复
热议问题