×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    45

    Not able to add Mobility APIs

    Code:
    TEMPLATE = app
    TARGET = TestN 
    
    QT        += core
    QT        += gui
    QT        += network
    
    HEADERS   += TestN.h
    SOURCES   += TestN_reg.rss \
        main.cpp \
        Test.cpp
    FORMS	  += TestN.ui
    RESOURCES +=
    
    
    CONFIG += mobility
    MOBILITY = systeminfo
    
    symbian:TARGET.UID3 = 0xEF1CA55B
    Code:
    #include <QtGui/QWidget>
    #include "ui_TestN.h"
    
    #include <qsysteminfo.h>
    
    class TestN : public QWidget
    {
        Q_OBJECT
    
    public:
    	TestN(QWidget *parent = 0);
        ~TestN();
    
    private:
        Ui::TestNClass ui;
        
    private:
    	QSystemInfo *iNetwrokInfo; //error: ISO C++ forbids declaration of `QSystemInfo' with no type ...
    
    };
    please help what am i missing ?

  2. #2
    Registered User
    Join Date
    Nov 2009
    Posts
    26

    Re: Not able to add Mobility APIs

    i think you missed the includepath for the system information api in your profile.
    INCLUDEPATH += ../../src/systeminfo
    the path depends on where you have extracted the mobility package.
    And you have to add the required symbian capabilites.
    The example "sysinfo" shows how to do that.

  3. #3
    Registered User
    Join Date
    Apr 2009
    Posts
    45

    Re: Not able to add Mobility APIs

    i tried adding that too . did not help

    Code:
    TEMPLATE = app
    TARGET = TestN 
    
    QT        += core
    QT        += gui
    QT        += network
    
    HEADERS   += TestN.h
    SOURCES   += TestN_reg.rss \
        main.cpp \
        Test.cpp
    FORMS	  += TestN.ui
    RESOURCES +=
    
    INCLUDEPATH += c:/qtmobility/src/systeminfo 
    
    
    CONFIG += mobility
    MOBILITY = systeminfo
    
    symbian:TARGET.UID3 = 0xEF1CA55B

  4. #4
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: Not able to add Mobility APIs

    as suggest in another thread try to run configure to export headers to Epoc32 also checked the files in include folder .
    Last edited by skumar_rao; 2009-12-15 at 17:28.

  5. #5
    Registered User
    Join Date
    Apr 2009
    Posts
    45

    Re: Not able to add Mobility APIs

    same result, i also tried every thing as suggested. no solution. yet any help

  6. #6
    Nokia Developer Moderator
    Join Date
    Sep 2007
    Posts
    123

    Re: Not able to add Mobility APIs

    Try to add QTM_USE_NAMESPACE macro before TestN class declaration. Mobility APIs are using QTM_NAMESPACE
    namespace and macro takes it for use.

  7. #7
    Registered User
    Join Date
    Apr 2009
    Posts
    45

    Re: Not able to add Mobility APIs

    thanks juhanak, it works. can you also provide where it has been instructed to add this macro just for my reference.

  8. #8
    Nokia Developer Moderator
    Join Date
    Sep 2007
    Posts
    123

    Re: Not able to add Mobility APIs

    I don't know if the maco is mentioned but doc\html\quickstart.html mentions that one should use QtMobility namespace.

  9. #9
    Registered User
    Join Date
    Oct 2008
    Posts
    1

    Re: Not able to add Mobility APIs

    Code:
    #include <QtGui/QWidget>
    #include "ui_TestN.h"
    
    #include <qsysteminfo.h>
    
    class TestN : public QWidget
    {
        Q_OBJECT
    
    public:
    	TestN(QWidget *parent = 0);
        ~TestN();
    
    private:
        Ui::TestNClass ui;
        
    private:
    	QSystemInfo *iNetwrokInfo; //error: ISO C++ forbids declaration of `QSystemInfo' with no type ...
    
    };
    You should not add the #include <qsysteminfo.h> into the header file. Instead add a forward declaration and include than the header in the source file

    Code:
    #include <QtGui/QWidget>
    #include "ui_TestN.h"
    
    namespace QtMobility
    {
      class QSystemInfo;
    }
    
    class TestN : public QWidget
    {
        Q_OBJECT
    
    public:
    	TestN(QWidget *parent = 0);
        ~TestN();
    
    private:
        Ui::TestNClass ui;
        
    private:
    	QtMobility::QSystemInfo *iNetwrokInfo;
    
    };

  10. #10
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: Not able to add Mobility APIs

    you forgot to add QTM_USE_NAMESPACE in your header file

  11. #11
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Not able to add Mobility APIs

    Quote Originally Posted by skumar_rao View Post
    you forgot to add QTM_USE_NAMESPACE in your header file
    QTM_USE_NAMESPACE is expanding to the following code:

    Code:
    #define QTM_NAMESPACE QtMobility
    #ifdef QTM_NAMESPACE
       #define QTM_USE_NAMESPACE using namespace QTM_NAMESPACE;
    #endif
    But there is a comment that in future namespace will be dynamic.

  12. #12
    Regular Contributor
    Join Date
    Mar 2009
    Posts
    430

    Re: Not able to add Mobility APIs

    Because I also had some trouble with that macro, can you give a reason why do you introduce such a namespace? Qt does not use namespaces by default. You introduce it and people have problems with it. Importing a namespace is ok, as long as it is documented. But what is your intention in providing a "dynamic" namespace? For me, this sounds like a bit like over-engineering. This means that you have to use some preprocessor macro.

  13. #13
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Not able to add Mobility APIs

    Quote Originally Posted by axeljaeger View Post
    Because I also had some trouble with that macro, can you give a reason why do you introduce such a namespace? Qt does not use namespaces by default. You introduce it and people have problems with it. Importing a namespace is ok, as long as it is documented. But what is your intention in providing a "dynamic" namespace? For me, this sounds like a bit like over-engineering. This means that you have to use some preprocessor macro.
    I don't know what was a rationale behind introduction QtMobility namespace, but Qt Creator is using Ui namespace for autogenerated code.

  14. #14
    Regular Contributor
    Join Date
    Mar 2009
    Posts
    430

    Re: Not able to add Mobility APIs

    Right, the generated class is in the Namespace Ui, but there is also a version Ui_-classname in case you dont want to use namespace. This is ok for me because the code involved is mainly autogenerated (the connection between my form class and the auto-generated code). My problem with the QtMobility namespace is that the the Qt-classes are already prefixed by a Q, so a namespace from the point of namespace-polution is not needed and should be disabled by default. If there is a company policy that requires code to be in a namespace, it should be of course possible, just like in the main Qt. I took me a while to figure out how the following code works from the mobile extension, therefore I'm not a friend of the namespaces in this case:

    examples/battery-publisher/main.cpp
    Code:
    #include <QApplication>
    
    #include <qvaluespace.h>
    
    #include "batterypublisher.h"
    
    int main(int argc, char *argv[])
    {
        QApplication app(argc, argv);
    
        QValueSpace::initValueSpaceServer();
    
        BatteryPublisher batteryPublisher;
        batteryPublisher.show();
    
        return app.exec();
    }
    You include qvaluespace.h to have QValueSpace included. But the user include batterypublisher.h is neccessary because it imports the namespace. The namespace import should be either in the main.cpp-file or the include to qvaluespace.h should be removed to make clear that it not independent from the import.

  15. #15
    Nokia Developer Expert
    Join Date
    Dec 2009
    Posts
    31

    Re: Not able to add Mobility APIs

    The main reason is that we want to avoid name clashes when Mobility classes move into Qt. This way you have to select the Mobility or Qt version version. Existing apps won't break even if Qt suddenly has the same class in it (possibly obtained via a Qt update on the device).

    The dynamic namespace is just following Qt convention. It could have been a hardcoded namespace as well.

Similar Threads

  1. is it possible to add icon to indicator pane?
    By topwingo in forum Symbian
    Replies: 1
    Last Post: 2007-01-19, 09:43
  2. is it possible to add icon to indicator pane?
    By topwingo in forum Symbian User Interface
    Replies: 3
    Last Post: 2007-01-19, 09:00
  3. Cannot add .lib file to VC6 project (Series 60 SDK)
    By ngabordh in forum Symbian Tools & SDKs
    Replies: 1
    Last Post: 2004-03-25, 15:13
  4. Audio Streaming APIs on 9210
    By Nokia_Archive in forum Symbian
    Replies: 1
    Last Post: 2002-05-30, 12:45

Posting Permissions

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