Symbian defines

  • Hi,

    I was just wondering which one would be the correct define to use for Symbian-devices when developing cross-platform apps: Q_OS_SYMBIAN or Q_WS_S60 ?

  • Moderators

    Both of course:-)

    Q_OS_ macros are used to show which operating system Qt was build for, while Q_WS_ macros show which windowing system Qt was build for. Depending on what you want to do one or the other might be a better choice: I would use Q_OS_ to wrap code that uses operation system specific code (networking, process management, etc.) and Q_WS_ for window specific code (like getting events not exposed through Qt, etc.).

    So, e.g. on MacOS you would use Q_OS_MAC for hardcore networking tasks and Q_WS_MAC for accessing display pdf. If you ever had to port your application to X11 on mac then the X11 windowing code would get wrapped in Q_WS_X11 ifdefs and your hardcore networking magic would still work.

  • Also I think Q_WS_S60 will not work for n8, but Q_OS_SYMBIAN will work.

  • Ok. Thanks guys.

    I sort of new that but asked anyway.

    Tobias, don't you have better things to do on a Saturday night ;)

  • Moderators

    riussi: Would you prefer getting your responses during regular business hours only? And you do not seem to have anything better to do on a saturday night either;-)

  • Hi,

    It somewhat depends. As Tobias said, if your code uses pure Symbian (no S60) then you should use Q_OS_SYMBIAN for maximum compatible. Q_WS_S60 will most likely not be defined on Symbian^4 where Avkon has been removed. However if you are using Avkon to, for example, lock the application's orientation, then Q_WS_S60 is the right choice.

    Q_WS_S60 is still defined on Symbian^3 because Avkon is still present.

  • jbarron, thanks for this small note about Symbian3 and Q_WS_S60. Assistant is a bit unclear about it (there is mention about Avkon, but no mention about Symbian3 and Avkon), maybe will be useful to add a note there.

  • Heh, Tobias. Just teasing you. Of course I appreciate your 24/7 attitude. Good for guys like me hacking away on Saturday nights :)

    It was nice to see you again at the Dev Days.

  • Another question popped into my mind.

    If I have a block like this in my .pro-file:

    @symbian {

    Custom kinetic scroller for Symbian since kinetic scrolling is not working there yet

    HEADERS += qscrollareakineticscroller.h \
               qkineticscroller.h \
    SOURCES += qscrollareakineticscroller.cpp \


    Is there any way to compile those only for >=5th edition and not for 3rd edition at all? I know I can use QSysInfo at runtime but then is there something to separate different versions of Symbian platform at compilation or .pro-file evaluation time?

  • If you have a look at the Qt Mobility configure tests which run on Symbian, you'll see a few which are related to the contacts and organizer domains. The results of those tests are used to determine which version of Symbian the project is being compiled on.

    In particular, take a look at plugins/organizer/symbian/ and plugins/contacts/symbian/ -- use the technique at your own risk, I'm certain there has to be a better way to do it. Indeed, someone more familiar with Symbian development might know of some file which only exists on S60 3rd edition, and so a qmake "exists(filename)" check might suffice.

    Hope this helps.


  • I would love to see config variables for different S60/Symbian versions defined appropriately by qmake or one of its many prf/pri tentacles.

  • Yeah, me too.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.