Open arkanoid87 opened 2 years ago
I see that dotherside already knows about QVariantList
maybe it could be the shortest path to add this feature
I've successfully passed a list from nim to qml by adding this to dotherside.nim
proc dos_qvariant_setArray(variant: DosQVariant, size: cint, array: ptr DosQVariantArray) {.cdecl, dynlib: dynLibName, importc.}
and this to qvariant.nim
proc toQVariant*(sequence: seq[QVariant]): QVariant =
result = newQVariant()
var arr = newSeqOfCap[DosQVariant](sequence.len)
for e in sequence:
arr.add e.vptr
dos_qvariant_setArray(result.vptr, sequence.len.cint, cast[ptr DosQVariantArray](arr[0].unsafeAddr))
return result
returning the generated QVariant to qml via data
method of model it ended up correctly on the other side
I've a list of polygons described like
I'm trying to write QAbstractListModel for MapItemView to display those polygons, but the delegate requires
path
to be an array of javascript objectsI'm trying to understand how to pass a seq of coordinates from my data proc considering that each polygon may have a variable number of vertices
I see that nimqml lacks QVariantList and QVariantMap but I am not aware if a workaround solution is possible.
I'm considering turning
Polygon
type into aQObject
and makeseq[Point]
one of its properties, but I don't know if it's possible to pass sequences from/to nimqml, that would mean declaring a list property using QQmlListProperty but it seems unavailable