Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Where should I call qmlRegisterType

[ Edited ]

@Zmey LOL, Great minds think alike! Smiley Happy

 

[Edit] Wouldn't it be nice to have some real-time indicator that informs you while editing a post that the thread has changed, it would be so useful on occasions. Smiley Happy

 


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 16,984
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Where should I call qmlRegisterType

According to the development adviser who posted about enums you should use qmlRegisterUncreatableType to register them.
Works fine for me.

 

example:

in c++

qmlRegisterUncreatableType<Sensitivity>("com.isec7.materials", 1, 0, "Sensitivity", "Sensitivity provides enum values. It cannot be instantiated.");

 in qml:

editedAppointment.sensitivity = Sensitivity.Private

 

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 1,157
Registered: ‎03-20-2013
My Device: Red LE Developer Z10
My Carrier: Fido

Re: Where should I call qmlRegisterType

Yep, this is what I do in my app too. Doing it this way prevents a developer from accidentally trying to instantiate the enum class. Unfortunately I only learned about this from Qt documentation. The Cascades docs currently don't cover much in-depth QML functionality. Qt is actually far more powerful than Cascades would lead you to believe.

 


simon_hain wrote:

According to the development adviser who posted about enums you should use qmlRegisterUncreatableType to register them.
Works fine for me.

 

example:

in c++

qmlRegisterUncreatableType<Sensitivity>("com.isec7.materials", 1, 0, "Sensitivity", "Sensitivity provides enum values. It cannot be instantiated.");

 in qml:

editedAppointment.sensitivity = Sensitivity.Private

 






Developer of Built for BlackBerry certified multiFEED RSS/Atom feed reader and aggregator.  multiFEED Icon

Play nice: Clicking Like Button on posts that helped you not only encourages others to continue sharing their experience, but also improves your own rating on this board. Also, don't forget to accept a post if it solves your problem or answers your question.