Today I run into another problem in BB10 Cascades, when I tried to add a timer to program, referring http://developer.blackberry.com/cascades/documentation/dev/signals_slots/signals_slots_set_up_project.html
My class in cpp file cannot be accessed in QML.
I called qmlRegisterType<Timer>("CustomTimer", 1, 0, "Timer"); in cpp file. But once I add "import CustomTimer 1.0", my UI cannot display. But the whole compiling process went well without any errors.
After struggling for 2 hours, I found the reason.
"qmlRegisterType<T>();" must be added as the first line in the class in cpp. Otherwise, it will not work...
No comments:
Post a Comment