Qml javascript function arguments lost on 5.2
-
wrote on 7 Feb 2014, 14:06 last edited by
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?
-
wrote on 7 Feb 2014, 14:58 last edited by
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=
-
wrote on 7 Feb 2014, 15:01 last edited by
I have the same problem 5.2.1. It has not worked since beta1.
Thanks for the welcome.
-
wrote on 7 Feb 2014, 15:02 last edited by
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.0Item {
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)) }
}@
-
wrote on 10 Feb 2014, 10:43 last edited by
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 -
wrote on 10 Feb 2014, 12:05 last edited by
Then the problem should be your custom viewer. Would you mind trying the samplecode i posted with a QQuickView?
-
wrote on 10 Feb 2014, 12:48 last edited by
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();@ -
wrote on 10 Feb 2014, 13:52 last edited by
Your code looks all okay so far, but why are you using QString::fromlatin1 for your source?
-
wrote on 10 Feb 2014, 15:02 last edited by
That looks a bit bad, but do you think this will cause my problem?
Any idea how to proceed?
-
wrote on 10 Feb 2014, 15:18 last edited by
I would highly guess that your problem is in your QuickView. Would you mind posting it's code so i can check it out?
-
wrote on 19 Feb 2014, 16:46 last edited by
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?