> <
http://doc.qt.digia.com/qt-5.2/qml-qtquick-workerscript.html>. However
> that uses a javascript file to do the thread processing and I'm not sure
> how to have the javascript file invoke a goroutine unless I expose that
> routine through some command line interface. Ideally I'd like to work
> within the QML and go file. Does anyone have a suggestion/direction on
> what I can do?
>
> Thanks!
>
You definitely need to expose some kind of routine from the go side.
It's a bit dated, but checkout search for "loadReportDataIntoGui" within
the .go source file:
https://github.com/omac777/goqmlsnowloadcount/blob/master/snowloadcountmain.go
-notice "qmlobject" and "ctrl" are used in it
-notice within load ReportDataIntoGui() has "go func() { ... }". That's
the trick. That's passing that part as separate task within this gopher
application. In fact when I load in all the data for all the different
gui controls, I'm attempting to do it in parallel and the gui doesn't
freeze up. The sample runs on ubuntu phone or ubuntu desktop just as
well. What makes it ubuntu specific is my choice of ubuntu-specific
qtcontrols rather than the Qt-shipped qtcontrols on the .qml-side.
https://github.com/omac777/goqmlsnowloadcount/tree/master/ui
go func() {
ctrl.SingleAxleMessage = strconv.Itoa( ctrl.Snldb.getSingleAxleTotal() )
qml.Changed(ctrl, &ctrl.SingleAxleMessage)
}()
There are probably better ways, but this one should still work.