Models in Go

138 views
Skip to first unread message

ben.davies...@gmail.com

unread,
Jun 18, 2015, 9:01:27 AM6/18/15
to go-...@googlegroups.com
Hi!

I am very very new to Go-QML! Can anyone give me a steer on the best way to implement models using Go-QML? I have a go routine that will be producing events that my go code handles. Another Go object will listen for these events and create new items to be appended to a list of items e.g. a slice or map. I would like to have QML render this map when new items are added to it. 

How would I:

- Make this map available to QML? I assume I'd have to adhere to some kind of interface and then register by object with the QML engine
- Or update an existing QML model to append the new items to it, forgoing the need for the map in the first place.

Loving Go-QML! It is truly astonishing how quickly I have been able to get something up and running!

Cheers!
Ben

Ben Davies

unread,
Jul 24, 2015, 7:09:07 AM7/24/15
to go-qml, ben.davies...@gmail.com
Hmmm... I take it this has had no response because there isn't yet a way to do this with go-qml?

David Marceau

unread,
Jul 24, 2015, 7:35:16 PM7/24/15
to go-...@googlegroups.com
It's not the most elegant, but I think this works:

https://github.com/omac777/goqmlsnowloadcount/blob/master/snowloadcountmain.go

This runs on ubuntu touch and ubuntu desktop given a bit of effort.
https://github.com/omac777/goqmlsnowloadcount

Cheers :)

Ben Davies

unread,
Jul 27, 2015, 5:04:44 AM7/27/15
to go-qml, uticdmar...@gmail.com
Thanks for the example, I'll have a look into this tonight.
Reply all
Reply to author
Forward
0 new messages