June 30, 2011

gronerth gronerth
Lab Rat
76 posts

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:

  1. #include <qmessageservice>
  2. #include <qmessage>
  3. #include <qmessageaddress>
  4. #include <qmessageManager>

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

  1. int main(int argc, char *argv[])
  2. {
  3.     QApplication app(argc, argv);
  4.  
  5.     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”:

  1. CONFIG += mobility
  2. MOBILITY += messaging

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

Thanks in advance!

 Signature 

——————————
JETG

10 replies

July 1, 2011

loladiro loladiro
Lab Rat
596 posts

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

July 1, 2011

gronerth gronerth
Lab Rat
76 posts
loladiro wrote:
What target are you building for (Simulator, Desktop, etc.)?

Symbian^3

 Signature 

——————————
JETG

July 1, 2011

Chuck Gao Chuck Gao
Lab Rat
342 posts

How about the code in Line 14 ?

 Signature 

Chuck

July 1, 2011

gronerth gronerth
Lab Rat
76 posts
Chuck.Gao wrote:
How about the code in Line 14 ?

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

  1. #include <QtGui/QApplication>
  2. #include <qmessageservice>
  3. #include <qmessage>
  4. #include <qmessageaddress>
  5. #include <qmessageManager>
  6. #include "qmlapplicationviewer.h"
  7.  
  8. QTM_USE_NAMESPACE
  9.  
  10. int main(int argc, char *argv[])
  11. {
  12.     QApplication app(argc, argv);
  13.  
  14.     QMessageService* serviceAction = new QMessageServiceAction();
  15.  
  16.     QmlApplicationViewer viewer;
  17.     viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
  18.     viewer.setMainQmlFile(QLatin1String("qml/QtMobilityExamples/main.qml"));
  19.     viewer.showExpanded();
  20.  
  21.     return app.exec();
  22.  
  23.     delete serviceAction;
  24. }

 Signature 

——————————
JETG

July 1, 2011

Chuck Gao Chuck Gao
Lab Rat
342 posts

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

 Signature 

Chuck

July 1, 2011

Chuck Gao Chuck Gao
Lab Rat
342 posts

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

 Signature 

Chuck

July 1, 2011

gronerth gronerth
Lab Rat
76 posts
Chuck.Gao wrote:
I’m sorry, but what’s the QMessageServiceAction ? It seems that’s the problem.

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…

Chuck.Gao wrote:
I can’t find the Class introduction in Qt document. So, where you find the code ?

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:

 Signature 

——————————
JETG

July 1, 2011

Chuck Gao Chuck Gao
Lab Rat
342 posts

I think them should be

  1. #include <qmessageservice.h>
  2. #include <qmessage.h>
  3. #include <qmessageaddress.h>
  4. #include <qmessageManager.h>

 Signature 

Chuck

July 1, 2011

loladiro loladiro
Lab Rat
596 posts

Chuck.Gao wrote:
I think them should be
  1. #include <qmessageservice.h>
  2. #include <qmessage.h>
  3. #include <qmessageaddress.h>
  4. #include <qmessageManager.h>
  5. @</blockquote>
  6.        
  7. 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).

July 1, 2011

gronerth gronerth
Lab Rat
76 posts

Chunk.Gao is the same behaviour:

headers

loladiro wrote:
either that or
  1. #include <QMessageService>
  2. #include <QMessage>
  3. #include <QMessageAddress>
  4. #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).

It still underline in Qt Creator:

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…

 Signature 

——————————
JETG

 
  ‹‹ verticalScrollBar()->triggerAction(QAbstractSlider::SliderPageStepAdd) sometimes work and othertimes doesn’t work      Minimal Configuration for Qt Embedded ››

You must log in to post a reply. Not a member yet? Register here!