×
Namespaces

Variants
Actions

Qt for Symbian console applications

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Code ExampleTested with
Devices(s): Tested on Nokia 5800 XpressMusic
QtSDK 1.1 (RC)
Compatibility
Platform(s): S60 3rd Edition, FP1, FP2
S60 5th Edition
Symbian^3
Symbian
Article
Keywords: QCoreApplication, console
Created: treinio (25 Sep 2009)
Last edited: hamishwillee (11 Oct 2012)

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

Contents

Preconditions

Changes to .pro file

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

In application main() function, create a QCoreApplication instance instead of QApplication.

int main( int argc, char *argv[] )
{
QCoreApplication a( argc, argv );
...
}


Notes

  • 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).


See also

Example project

File:Qt minimalconsole.zip

This page was last modified on 11 October 2012, at 04:18.
56 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×