08-29-2013 02:09 PM
I have created a Cascades Shared Library so I can reuse code for applications. I am successfully able to access the library's C++ source files in the application that has imported them. However, I cannot do the same with QML files. The Qt documentation did have some material on creating custom QML modules but I did not have any luck. I also tried a workaround by creating a C++ class (CustomLabel) inside the library. This class extends bb::cascades::CustomControl. I am able to import the class without any issues into my application and I also have the following line in my applicationui.cpp file:
qmlRegisterType<CustomLabel>("CustomLabel", 1, 0, "CustomLabel");
However, when I go into main.qml on the application side, it cannot find the library when I enter in the following: import CustomLabel 1.0. However, If I define CustomLabel on the application side instead of the shared library, it works fine.
Any idea of why that is happening? Is there any way to have custom QML components defined in a shared/static library such that it can be reused in an application?
11-23-2013 08:28 AM - edited 11-23-2013 08:29 AM
I'm having the same issue.
(I'm trying the C++ extend Cutomcontrol way)
When I try to add the qmlRegisterType, I get this error:
do you also have this error or a similar error?
12-01-2013 05:04 PM
I got it working for me:
I put a sample up on: