0

I have one Qt application (App1). I want to run App1 from another qt application (App2). I have tried using QProcess but App1 doesnt run. Kindly help me out. I am working on RHEL 6.

     QProcess process = new QProcess();
    QString program = "/home/user1/Desktop/MyApp/App1";
    process->start(program);
Abhishek
  • 338
  • 5
  • 20

2 Answers2

1

Try this:

int exitCode = QProcess::execute(program);
qDebug("Exit code is: %d.", exitCode);

and check what happens. This is a sync call. After you understand what is happening, change it back to async if you need it.

Luca Carlon
  • 9,546
  • 13
  • 59
  • 91
  • With this code, App1 execution begings but i am getting error as ERROR!! could not open : App1.ui Exit code is: 1. Although App1.ui is present in same folder – Abhishek Sep 27 '12 at 08:45
  • Then check the ExitStatus and ProcessError using QProcess so that you can collect more information. – Luca Carlon Sep 28 '12 at 08:03
  • working fine now..Thanks Is it possible to show the newly executed application inside my current class QWidget? – Abhishek Oct 01 '12 at 09:40
1

Try this:

QProcess *p= new QProcess(this);
p->start("yourotherapp.exe",QIODevice::ReadWrite);
benka
  • 4,732
  • 35
  • 47
  • 58