Calling a Go function with array argument panics

47 views
Skip to first unread message

Jani Monoses

unread,
Aug 3, 2015, 4:11:19 PM8/3/15
to go-qml
Hello,

I ran into https://github.com/go-qml/qml/issues/137 when trying to pass an array of strings to a method defined in Go.
Is there a workaround for this?
To reproduce here's a diff for the particle example

thanks,
Jani

diff --git examples/particle/main.go examples/particle/main.go
index 2a7ab86..dced020 100644
--- examples/particle/main.go
+++ examples/particle/main.go
@@ -45,6 +45,10 @@ type Control struct {
        Message string
 }
 
+func (ctrl *Control) Test(l []string) {
+       fmt.Printf("%+v\n", l)
+}
+
 func (ctrl *Control) TextReleased(text qml.Object) {
        x := text.Int("x")
        y := text.Int("y")
diff --git examples/particle/particle.qml examples/particle/particle.qml
index 1fd1f1c..418573e 100644
--- examples/particle/particle.qml
+++ examples/particle/particle.qml
@@ -30,7 +30,7 @@ Rectangle {
                    id: mouseArea
                    anchors.fill: parent
                    drag.target: parent
-                    onReleased: ctrl.textReleased(parent)
+                    onReleased: ctrl.test(["a", "b"])
                }
        }
 

Reply all
Reply to author
Forward
0 new messages