Qt for Symbian console applications
Jump to navigation
Jump to search
Preconditions[edit | edit source]
- Install the Qt SDK
Changes to .pro file[edit | edit source]
Note that CONFIG += console definition has no effect in Qt. However, with Qt Simulator as the build target, it can be used to run the project as a Win32 console application, with no Simulator UI.
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:
symbian: {
CONFIG += no_icon
}
Changes to source code[edit | edit source]
In application main() function, create a QCoreApplication instance instead of QApplication.
int main( int argc, char *argv[] )
{
QCoreApplication a( argc, argv );
...
}
Notes[edit | edit source]
- 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).