Launching a native application from Qt
Article Metadata
Tested with
SDK: Qt SDK
Devices(s): Nokia 5800 XpressMusic
Compatibility
Platform(s): S60 3rd Edition, FP1, FP2
S60 5th Edition
S60 5th Edition
Article
Keywords: QProcess
Created: tepaa
(29 Apr 2009)
Last edited: hamishwillee
(11 Oct 2012)
Contents |
Overview
This code snippet shows how to launch a native application from Qt. The example has been tested launching the Symbian camera application on the Symbian platform, but the code should work generically.
Header
The ProcessHandler starts the process and listens for its states.
#include <QObject>
#include <QProcess>
class ProcessHandler : public QObject
{
Q_OBJECT
public:
ProcessHandler(QObject *parent = 0);
~ProcessHandler();
public:
void StartCameraApp();
public Q_SLOTS:
void stateChanged(QProcess::ProcessState state);
void error(QProcess::ProcessError error);
private:
QProcess* process;
};
Source
Create QProcess and start listening for process state changes.
Class descruction:
ProcessHandler::~ProcessHandler()
{
if (process->state() != QProcess::NotRunning)
{
// Close process if it is running
process->close();
}
}
Start the Symbian native camera Cameraapp.exe:
void ProcessHandler::StartCameraApp()
{
QString program = "Cameraapp.exe";
process->start(program);
}
QProcess signals the error to the error slot:
QProcess signals the process state changes to the stateChanged slot.
Postconditions
The Symbian native camera is started.

