Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to get external App into foreground ?



  • Hi,

    I use the routine below to launch external applications.
    I am searching for a way to bring those external apps into the foreground
    and give it a higher priority - while they are running.

    thx Alexander

    void MyApp::startExternalApp(QString cmd, QStringList arguments)
    {
        this->setCursor(QCursor(Qt::BusyCursor));
    
        mcProcess = new QProcess(this);
        mcProcess->start(cmd, (QStringList) arguments);
    
        bool success = mcProcess->waitForStarted(0);
        qDebug() << mcProcess->program() << " " << mcProcess->arguments() << "started" << success;
    
        success = mcProcess->waitForFinished(5000);
        qDebug() << mcProcess->program() << " " << mcProcess->arguments() << "finished" << success;
        qDebug() << "Process error:" << mcProcess->error();
        qDebug() << "Process exit code:" << mcProcess->exitCode();
        qDebug() << "Process state:" << mcProcess->state();
    
        this->setCursor(QCursor(Qt::ArrowCursor));
    }
    


  • is mcProcess running a gui app?



  • @JoeCFD Yes it does


Log in to reply