# Communication between QML and Julia

**URL:** https://discourse.julialang.org/t/communication-between-qml-and-julia/69617
**Category:** Visualization
**Created:** [October 12, 2021, 12:03pm UTC](https://discourse.julialang.org/t/communication-between-qml-and-julia/69617 "2021-10-12T12:03:37Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![etas](https://avatars.discourse-cdn.com/v4/letter/e/ecae2f/32.png) [@etas](https://discourse.julialang.org/u/etas)
#### Post date: [October 12, 2021, 12:03pm UTC](https://discourse.julialang.org/t/communication-between-qml-and-julia/69617/1 "2021-10-12T12:03:37Z")

</div>

Hi, I’m trying to make a light UI with QML but I didn’t find the way to call Julia functions from QML with a vector as parameter and to use this vector in Julia. This example calls the Julia function `fct1` when a button, opened in a window, is pressed.  
In julia :

```julia
using QML
using Qt5QuickControls_jll
using Qt5QuickControls2_jll

function fct1(var1)
    println(typeof(var1))
    println(var1)
    println(var1[1])
end

@qmlfunction fct1
loadqml("returnVector.qml")
exec()

```

In qml :

```julia
import QtQuick 2.2
import QtQuick.Dialogs 1.0
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.0
import org.julialang 1.0

ApplicationWindow {
  id: appWindow
  visible: true

    Item {
        id: cst
        property var vect1: [0,0.5,1]
    }

    Button {
        //Layout.alignment: Qt.AlignCenter
        text: qsTr("click")
        onClicked: { Julia.fct1(cst.vect1) }
    }
}

```

I obtain a vector of type `QVariant[QVariant of type Int32 with value 0, ...]` and I didn’t find a way to transform it in a usable form in Julia. And I’m not even able to say if I’m completely wrong or if it’s just a little trick.

If someone has an idea, or could explain what precautions we have to take to pass from QML world to Julia world, I’m very interested 🙂  
Thanks !
