Qml javascript function arguments lost on 5.2



  • Hi,

    Since version 5.2 I have a big issue with qml, javascript and parameter passing on my mips based linux system. It worked fine in 5.2.beta1 and then it stopped working on my hardware.

    The following little qml results in the output "Hello Word 0" on screen. Same is written regardless of argument type and value.

    @import QtQuick 2.0
    Rectangle {
    width: 1280
    height: 720
    Text {
    anchors.centerIn: parent
    text: "Hello World " + func(666)
    }
    function func(halfHours) {
    return halfHours;
    }
    }@

    Any ideas on what to do?



  • Hello and welcome to qt-project.org,

    i have tried it using Qt 5.2.1 and it worked fine. It is probably a bug in 5.2.0 so i would recommend you to report it and to update up to 5.2.1.

    "Bugreport":https://bugreports.qt-project.org/issues/?jql=



  • I have the same problem 5.2.1. It has not worked since beta1.

    Thanks for the welcome.



  • You have the same problem in 5.2.1? Which Viewer are you using to display your QML? And could you please post the console output using this code:
    @import QtQuick 2.0

    Item {
    function func(halfHours) {
    return halfHours
    }
    function funcTwo(halfHours) {
    var temp = [halfHours]
    return temp.toString()
    }

    Component.onCompleted: {
        console.log(func(444))
        console.log("String and " + func(555))
        console.log("String and " + func("String"))
        console.log("String and " + func(0.1))
        var number = func(666)
        console.log("String and " + number)
        console.log("String and " + funcTwo(777))
    }
    

    }@



  • I use a custom viewer. The results are:
    784 18:42:26.144 qml-launcher(289) None: 0
    785 18:42:26.145 qml-launcher(289) None: String and 0
    786 18:42:26.145 qml-launcher(289) None: String and 0
    787 18:42:26.145 qml-launcher(289) None: String and 0
    788 18:42:26.146 qml-launcher(289) None: String and 0
    789 18:42:26.146 qml-launcher(289) None: String and 0



  • Then the problem should be your custom viewer. Would you mind trying the samplecode i posted with a QQuickView?



  • I guess i used the wrong terminology. I use a custom application that works fine on qt 5.0. For some reason qmlscene crashes due to a seg fault i 5.2.1.
    I do like this.

    @QGuiApplication app(argc, argv);
    QuickView View;
    View.setResizeMode(QQuickView::SizeRootObjectToView);
    View.setGeometry(0, 0, 1280, 720);
    View.setSource(QUrl(QString::fromLatin1(uri.c_str())));
    View.show();@



  • Your code looks all okay so far, but why are you using QString::fromlatin1 for your source?



  • That looks a bit bad, but do you think this will cause my problem?

    Any idea how to proceed?



  • I would highly guess that your problem is in your QuickView. Would you mind posting it's code so i can check it out?



  • We also have the same issue but after a few scope name changes (I mean: use some property with extended dot notation inside the same qml file) our applications worked well on desktop.
    Our BIG issue is that the target of this application is the i.MX6 board and on that platform (using the same version of Qt 5.2.1 compiled following the freescale guidelines) the application still have strange behaviour and thousands of runtime warnings/errors regarding javascript and in particular string variables.
    I think that this happens because in Qt 5.2 javascript has moved to V4 and in this cross compilation environment we use the linaro toolchain gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12 .
    Anyone have experienced the same problem?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.