blackberry 10 Unresolved inclusion <QObject>

安稳与你 提交于 2019-12-18 16:25:13

问题


I'm using the new version of Blackberry (Blackberry 10) . I'm trying to integrate c++ code with QML , but I faced some problems that I thinks connected to other . in the .h file Q_OBJECT , Q_PROPERTY signals and slots shows that there is syntax error . and in the QML file in which I try to use this type (i.e import CustomTimer 1.0 for example) I got this problem module "CustomTimer" is not installed . how to solve this issue???


回答1:


I'm using QNX Momentics Version 10.1.0

I resolved my errors by right-clicking on my project folder, then selecting Configure -> Add Library..., and then choose Standard BlackBerry Platform Library. Choose the relevant library to include and click Finish.

For QObject, I found it under Platform > Qt Core




回答2:


I corrected the issue in following manner:

  1. Right Click on your project in Project Explorer.
  2. Goto Index.
  3. click Rebuild.



回答3:


For the syntax errors that you are reporting in QNX Momentics for the Q_OBJECT macros and other Qt macros, these errors went away for me after updating to the latest Momentics and SDK release. However, there are still some others who seem to have this issue, and some workarounds have been posted in the Blackberry Developer support forums:

http://supportforums.blackberry.com/t5/Cascades-Development/Beta-4-Momentics-IDE-autocompletion-does-not-work-for-Qt-classes/td-p/2014793

For the error in your QML file, I think you encountering a known limitation with the QML preview for custom components from C++ registered and imported into QML. The QML preview only understands how to display the core Cascades components. This should not affect how your code runs in the simulator or on an actual device.

See:

https://developer.blackberry.com/cascades/download/releasenotes/

under "Known Limitations":

QML preview with C++ objects The QML preview can load and render components based on the Cascades plug-in only (in bb.cascades 1.0). Objects that are registered in C++ in your project are not understood by the QML preview and cannot be loaded and rendered.

In some cases, as a workaround in order to see the preview for the rest of your QML document, you can just comment out the import MyLibrary 1.0 when using the QML preview. However in some cases this could mean commenting out half of your document. For more than very basic QML layouts, and usually after the initial design stage, I have found it more efficient just to build and launch my app to view the actual working QML UI.




回答4:


This worked for me:
I right-clicked my project, and selected in the drop-down menu:

Index > Re-resolve Unresolved Includes
Index > Rebuild

(Using Momentics 2.1.1)



来源:https://stackoverflow.com/questions/13953916/blackberry-10-unresolved-inclusion-qobject

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!