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

Posts: 224
Registered: ‎03-29-2012
My Device: 9900
My Carrier: Wind

First QML/C++ Application

Hey everyone! Making my first application using Cascades and was wondering, is it best to handle events in qml or link it to  the C++? I know they can be handled in either separately or using signals and slots link together, is one preferrable? I know QML is best for the UI and then maybe the c++ should handle the logic such as the event conditions etc? 


Is this the ideal way of approaching this and if so, is there documentation on connecting the QML to the C++ for events? I'm pouring through it now, but so far I can just find signal and slot documentation on either all QML or C++ but not in this fashion. As always thanks guys and any input would  be great help Smiley Happy

Posts: 34
Registered: ‎06-19-2012
My Device: BlackBerry Z10 Ltd Edition
My Carrier: giffgaff

Re: First QML/C++ Application

JS vs C++

It's personal preference - both JavaScript (in QML) and C++ can be used to handle events. One way of approaching it might be to use QML for any events which are application-logic (i.e. display state etc.) and C++ for business-logic events.


However, it really can vary however you want.


"Connecting" QML to C++

There's quite a lot of documentation on signals, properties and slots in QML - and tying them into C++ objects - in the QML Signals and Handler Event System section of the Qt docs.

Andrew Flegg -- mailto:andrew@bleb.org | http://www.bleb.org