Open cjslep opened 9 years ago
+1. I've been unable to hand over anything but basic structs containing strings, ints/floats, and bools and no nesting, slices, maps, or arrays. Everything else I've tried in go-qml has worked great though, I feel this would add a lot of functionality. It might currently be possible to publish some json string to QML and unmarshal them there but that seems silly.
The current workaround is to add go functions that do array accessing or manipulation or storing. These functions can be called from qml and enable slice manipulation via these function calls. It is more verbose than native support, but it works.
On Oct 7, 2015, at 12:44, Hayden Parker notifications@github.com wrote:
+1. I've been unable to hand over anything but basic structs containing strings, ints/floats, and bools and no nesting, slices, maps, or arrays. Everything else I've tried in go-qml has worked great though, I feel this would add a lot of functionality. It might currently be possible to publish some json string to QML and unmarshal them there but that seems silly.
— Reply to this email directly or view it on GitHub.
What if I wanted to display a list of some struct in QML, would returning a slice from an accessible function work?
I was trying my hand at creating a dynamically-populated table from data in go, when I got a
please report to the developers
error:I am basically trying to access the following struct definitions with test data:
The registration on the go side to make it accessible:
The basic QML:
I looked into other API calls to see if I was doing something incorrect. Nothing seemed obvious to me. The only thing slightly relevant could be registering the
ColumnHeader
go type, but I am not instantiating new copies of that struct on the qml side. I have another data type (lets call itAppSettings
) that isSetVar
d similarly but does not have any interactions with TableViews.AppSettings
also contains a slice of structs from a different package that is nothing but a struct of primitives, and it seems to do fine, so I am slightly baffled.