Qt for Symbian console applications
This code example demonstrates how to build GUI-less (console) applications in Qt. This can be used for GUI-less background applications or for testing code that only uses functionality from QtCore module
- Install the Qt SDK
Changes to .pro file
For Symbian builds, the following line in .pro file can be used to prevent linking to GUI library:
QT -= gui
In addition, it may be useful to disable generation of icon and UI -related resources for Symbian devices:
CONFIG += no_icon
Changes to source code
In application main() function, create a QCoreApplication instance instead of QApplication.
int main( int argc, char *argv )
QCoreApplication a( argc, argv );
- When using CONFIG += no_icon, there is no way for the user to launch the executable from the application menu. It has to be launched by other means; by another process or (typical for background applications) by adding it to the list of applications run at device startup.
- As it is a QCoreApplication, it does not have any associated root window and therefore it's not visible in the Symbian/S60 list of running applications (task switcher).
- For debugging purposes, if the application writes to standard output it may be useful to install Archived:Redirecting stdin and stdout streams in Open C package from Open C/C++ Plug-In. Obviously, on-Device-Debugging directly from the IDE with AppTRK is always preferred, but ODD service is not always available (for example, when the application is launched already during device startup).