Blackberry 10 Unauthorized inclusion of <QObject>
I am using the new version of Blackberry (Blackberry 10). I am trying to integrate C ++ code with QML, but I ran into some problems that I think are related to others. in the .h file of Q_OBJECT, Q_PROPERTY signals and slots indicate that there is a syntax error. and in the QML file in which I am trying to use this type (for example, importing CustomTimer 1.0), I got this problem module "CustomTimer" not installed. How to solve this problem???
I am using QNX Momentics Version 10.1.0
I resolved my mistakes by right-clicking on the project folder, then choosing Configure -> Add Library... , and then select "Standard BlackBerry Platform Library". Select the appropriate library to enable and click Finish .
For QObject I found it under Platform > Qt Core
I fixed the problem as follows:
- Right-click on a project in Project Explorer.
- Go to index.
- Click Restore.
For the syntax errors that you report in QNX Momentics for Q_OBJECT macros and other Qt macros, these errors went away for me after upgrading to the latest version of Momentics and the SDK. However, there are some others that seem to have this problem, and some workarounds have been posted on the Blackberry Developer Support Forums:
For the error in your QML file, I think you came across a well-known restriction with QML preview for custom components from C ++ registered and imported into QML. Preview QML understands how to display the core components of Cascades. This should not affect how your code works in the simulator or on the device itself.
Cm:
https://developer.blackberry.com/cascades/download/releasenotes/
in the Known Limitations section:
Previewing QML with C ++ objects Previewing QML can load and display components based only on the Cascades plug-in (in bb.cascades 1.0). Objects registered in C ++ in your project are not understood using QML preview and cannot be loaded and displayed.
In some cases, as a workaround, to preview the rest of your QML document, you can simply comment on import MyLibrary 1.0 when using QML preview. However, in some cases, this may mean commenting on half of your document. For more than very simple QML layouts, and usually after the initial development phase, I only found it more efficient to create and run my application to view the actual working QML interface.
This worked for me:
I right-clicked my project and selected it from the drop-down menu:
Index > Re-resolve Unresolved Includes Index > Rebuild 
(Using Momentics 2.1.1)