×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Jun 2012
    Posts
    13

    To develop an application for N9 and N900

    I developped an application for N9. When I check with Qt simulator this application on N900 device, it's not really good on the screen. If I change parameters the result is good for N900 but not for N9.

    My question is : What programm lines must I write in my application to know if the device is N9 or N900 in order to put the specific parameters for each device.

    For example What do I write in ???????
    If (????????????)
    {N9 parameters}
    else
    {N900 parameters}

    Luc

  2. #2
    Registered User
    Join Date
    Jul 2008
    Posts
    90

    Re: To develop an application for N9 and N900

    In your .pro file you can set some defines, any way you wish, based on the target:
    maemo5 {
    DEFINES += N900
    } else {
    DEFINES += N9
    }

    ...and in your C++ code, just use conditional compiling based on those:
    #ifdef N900
    ...
    #endif

  3. #3
    Registered User
    Join Date
    Jun 2012
    Posts
    13

    Re: To develop an application for N9 and N900

    Thank you very much, but I am beginning to develop phone applications so in concrete terms in my .pro file, I write
    */
    SOURCES += \
    main.cpp \
    mainWindow.cpp

    HEADERS += \
    mainWindow.h

    maemo5 {
    DEFINES += N900
    } else {
    DEFINES += N9
    }
    */

    and I put nothing in my mainWindow.h and in my mainWindow.cpp I write for example at the beginning of this file

    */
    ifdef N900
    {int u(5), V(6),...}
    else
    {int u(3),v(8)....}
    .........
    */


    Luc

  4. #4
    Regular Contributor
    Join Date
    May 2010
    Posts
    362

    Re: To develop an application for N9 and N900

    Yes. Except remember the hash (#) mark before ifdef in your .cpp file. You can use these #ifdefs in .h file too.

  5. #5
    Registered User
    Join Date
    Jun 2012
    Posts
    13

    Re: To develop an application for N9 and N900

    Thanks you very match

  6. #6
    Registered User
    Join Date
    Jun 2012
    Posts
    13

    Re: To develop an application for N9 and N900

    But there are another pb. The compilation stops and writes that u and v ( my parameters) are not declared in this scope.
    The beginning of my mainwindows

    #include "FenPrincipale.h"
    #include "personnage.h"

    #ifdef N900
    {int u(18), v(31)}
    else
    {int u(20),v(35)}
    #endif

    FenPrincipale::FenPrincipale(QWidget *parentprincipal, QString pseudo,int dimTab,int niveau,int nbrCoup,bool boleen) : QWidget(parentprincipal)
    {.... function with the parameters u, v inside ....}

  7. #7
    Regular Contributor
    Join Date
    May 2010
    Posts
    362

    Re: To develop an application for N9 and N900

    It is because they are out of scope. You have determined the scope with { }. Just leave them out and it works.

    #ifdef N900
    int u(18), v(31);
    else
    int u(20), v(35);
    #endif

  8. #8
    Regular Contributor
    Join Date
    May 2010
    Posts
    362

    Re: To develop an application for N9 and N900

    Although, if you only use these as constant "magic numbers" (don't change them), you should use them as #defines too.

    #ifdef N900
    #define MY_U 18
    #define MY_V 31
    #else
    #define MY_U 20
    #define MY_V 35
    #endif

    Then use them as

    int something = 59*MY_U;

  9. #9
    Registered User
    Join Date
    Jun 2012
    Posts
    13

    Re: To develop an application for N9 and N900

    It's ok, the application have been compiled

    Thanks you very much

Similar Threads

  1. Qt application on Nokia n900
    By mazeemanwar in forum Nokia N9
    Replies: 1
    Last Post: 2012-01-16, 12:02
  2. run application on my N900
    By m-lamaa in forum Nokia N9
    Replies: 3
    Last Post: 2010-10-21, 17:52
  3. how to install application on maemo n900
    By david_hdse in forum General Development Questions
    Replies: 1
    Last Post: 2010-06-06, 22:23
  4. Convert application from Qt for Symbian to N900
    By wktsang1 in forum Nokia N9
    Replies: 15
    Last Post: 2010-05-06, 09:10
  5. N900 not on selected mobile list N900 search problems
    By jimgilmour1 in forum [Closed] Publishing to Nokia Store
    Replies: 0
    Last Post: 2010-02-16, 09:30

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×