Qt Mobility in QtSDK



  • Hello everyone,

    I am trying to play with the APIs of QtMobility, but i am having compiling errors. I am including the following headers:

    @
    #include <qmessageservice>
    #include <qmessage>
    #include <qmessageaddress>
    #include <qmessageManager>
    @

    Then, i am adding the macro QTM_USE_NAMESPACE, then in the main code i am doing something like this:

    @
    int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);

    QMessageService* serviceAction = new QMessageServiceAction();
    

    @

    But i am having the following errors:

    C:\Users\JTorres\Documents\QtProjects\QML\QtMobilityExamples\main.cpp:14: error: expected type-specifier before 'QMessageServiceAction'
    C:\Users\JTorres\Documents\QtProjects\QML\QtMobilityExamples\main.cpp:14: error: cannot convert 'int*' to 'QtMobility::QMessageService*' in initialization
    C:\Users\JTorres\Documents\QtProjects\QML\QtMobilityExamples\main.cpp:14: error: expected ',' or ';' before 'QMessageServiceAction'

    In the .pro file i am adding "mobility":

    @
    CONFIG += mobility
    MOBILITY += messaging
    @

    Anyone knows what i am doing wrong?, it is like the compiler is not finding the right headers.

    Thanks in advance!



  • What target are you building for (Simulator, Desktop, etc.)?



  • [quote author="loladiro" date="1309473181"]What target are you building for (Simulator, Desktop, etc.)?[/quote]

    Symbian^3



  • How about the code in Line 14 ?



  • [quote author="Chuck.Gao" date="1309483595"]How about the code in Line 14 ?[/quote]

    This is the complete code in main that i wrote just for testing:

    @
    #include <QtGui/QApplication>
    #include <qmessageservice>
    #include <qmessage>
    #include <qmessageaddress>
    #include <qmessageManager>
    #include "qmlapplicationviewer.h"

    QTM_USE_NAMESPACE

    int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);

    QMessageService* serviceAction = new QMessageServiceAction();
    
    QmlApplicationViewer viewer;
    viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
    viewer.setMainQmlFile&#40;QLatin1String("qml/QtMobilityExamples/main.qml"&#41;);
    viewer.showExpanded();
    
    return app.exec();
    
    delete serviceAction;
    

    }
    @



  • I'm sorry, but what's the QMessageServiceAction ? It seems that's the problem.



  • I can't find the Class introduction in Qt document. So, where you find the code ?



  • [quote author="Chuck.Gao" date="1309485224"]I'm sorry, but what's the QMessageServiceAction ? It seems that's the problem.[/quote]

    You`re absolutely right!!!!, i was changing the code "QMessageServiceAction" to "QMessageService", but i couldn't see that i forgot to change one of them, so sorry, my misstake...

    [quote author="Chuck.Gao" date="1309485283"]I can't find the Class introduction in Qt document. So, where you find the code ?[/quote]

    I have found it in a book called "Qt for Symbian", maybe in Qt Mobility 1.0 that class exists....

    By the way, is it normal that the headers appear "underlined" like if it doesn't exist:

    !http://img269.imageshack.us/img269/7177/headersnw.png!



  • I think them should be
    @
    #include <qmessageservice.h>
    #include <qmessage.h>
    #include <qmessageaddress.h>
    #include <qmessageManager.h>
    @



  • [quote author="Chuck.Gao" date="1309487447"]I think them should be
    @
    #include <qmessageservice.h>
    #include <qmessage.h>
    #include <qmessageaddress.h>
    #include <qmessageManager.h>
    @[/quote]

    either that or
    @
    #include <QMessageService>
    #include <QMessage>
    #include <QMessageAddress>
    #include <QMessageManager>
    @
    Also as long as the compiler doesn't give you a header not found warning, it may be ok that it's underlined in Qt Creator (the include path is set through qmake and I don't know if Qt Creator parses that properly-there are two different parser implementation and qmake's is larger).



  • Chunk.Gao is the same behaviour:

    !http://img829.imageshack.us/img829/2765/headers2.png(headers)!

    [quote author="loladiro" date="1309515767"]either that or
    @
    #include <QMessageService>
    #include <QMessage>
    #include <QMessageAddress>
    #include <QMessageManager>
    @
    Also as long as the compiler doesn't give you a header not found warning, it may be ok that it's underlined in Qt Creator (the include path is set through qmake and I don't know if Qt Creator parses that properly-there are two different parser implementation and qmake's is larger).
    [/quote]

    It still underline in Qt Creator:

    !http://img84.imageshack.us/img84/571/headers3.png!

    The compiler doesn't give me any warning about those headers, i mean it compiles fine...but the Qt Classes that are inside that headers, won't be highlighted in the code editor and i can't use the autocompletion method because the Qt Creator parser doesn't find those headers...


Log in to reply
 

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