Ahmad Mansoori
Ahmad Mansoori

Reputation: 179

Connections type does not work on raspberry

I have below code that work on my machine:

Connections{
    target: gridmodel
    enabled: true
    function onDataFetch(status){
        console.log(status, "it is status")
        loaderrorlbl.visible = !status
    }
    Component.onCompleted:{
        console.log("Connection created")
    }
}

With this imports:

import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Controls.Material 2.0
import QtQuick.Layouts 1.0

onDataFetch is a signal in my Python side:

dataFetch = Signal(bool)

the project works just fine on my machine, but when I run it in raspberry/raspbian, everything works except onDataFetch in Connection.

I am using pyside2 on both machines, and QML import is the same, qmake – version in my machine is:

QMake version 3.1
Using Qt version 5.15.2 in /usr/lib/x86_64-linux-gnu

And on raspbian:

QMake version 3.1
Using Qt version 5.11.3 in /usr/lib/arm-linux-gnuabihf

I didn't find any solution for this, or similar issues online, does anybody knows the problem?

Upvotes: 0

Views: 52

Answers (1)

eyllanesc
eyllanesc

Reputation: 243955

Using function as a slot is part of the new qml syntax, and since you are using an old version then it doesn't support it. You must change it to:

Connections {
    target: gridmodel
    onDataFetch: function(status){
        console.log(status, "it is status")
    }
}

Note: If you want to develop a compatible code for rpi then you can install a version similar to the one you use: python -m pip install PySide2==5.11.2

Upvotes: 2

Related Questions