开发者

about including QcontactObserver in my Qt project?

开发者 https://www.devze.com 2023-04-10 05:44 出处:网络
I want to run the example found here: http://doc.qt.nokia.com/qtmobility-1.2/samplephonebook.html But I have an error in this line:

I want to run the example found here: http://doc.qt.nokia.com/qtmobility-1.2/samplephonebook.html

But I have an error in this line:

QContactObserver* m_obs开发者_StackOverflow社区erver;

The error is:

ISO C++ forbids declaration of 'QContactObserver' with no type

in the contacteditor.h file.

What's wrong ? What should I do for that to run?


This question may well have already been solved for the original OP, but for the sake of other users stumbling onto it:

QContactObserver is part of Qt Mobility. Although Qt Mobility is included with the QtSDK, it must be unpacked and built on the development system to ensure that it is configured properly to be used in a project on that system.

In addition, the .pro file requires additions to prompt it to include the required Qt Mobility headers. For example, QContactObserver is part of the QtContacts module, so the .pro file would require the follwing additional lines:

CONFIG += mobility
MOBILITY += contacts

The error mentioned in the comments above:

MBX: you sure have a #include <QContactObserver>, don't you?

Marwa Shams: when i include it .. I have an error "no such file or directory"

occurs because Qt does not know where to look for the <QContactObserver> headers. Following the steps above will remedy the problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号