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
Highlighted
Contributor
Posts: 27
Registered: ‎09-03-2012
My Device: Blackberry Playbook
My Carrier: None

Best practice to link QML and C++ thread

hi

In my app, I have a worker thread plodding away in the background getting data from the web and updating the UI asynchronously (around every second or two). The QML UI has a lot of info that needs updating all the time (values and sizes of QObjects, data in ListViews, text fields, etc) and I'm not sure what the best practice is for this; 

I have a skeleton app working nicely but before I beef it up I wanted your advise.

 

My QThread emits signals that are caught by my QObject code and I current set properties defined at the top of my QML file. But I would need hundreds of properties!!!

Or should I (in my c++ code) search for each object in the QML and store all those (maybe 40 or 50) in c++?

Or should I send just one signal to the QML and get the QML (maybe javascript?) to get all the data from the c++ QObject and update, so have an RefreshUI function in the QML to update all, instead of update bit by bit from c++

I'm just not sure what the right way is Smiley Sad

Hope the above makes some sense

many thanks