Unsolved help with js and qml
-
so i have a js function to get event data from an ics online calendar verified works
i want to use this function to print that event in the clock.qml code as part of the lockscreen ui....so far i have this in the qml code
import "/run/media/hammer/Data/projects/nat-day2.js" as NatDay
...
Label {
text: NatDay.nat_day()
// text: "National Day"
font.family: "Roboto"
font.pointSize: 24
Layout.alignment: Qt.AlignHCenter
renderType: Text.QtRendering
}nothing shows up, is it wrong? how do i test qml code to see errors?
thanks
-
hi,
try to see what NatDay.nat_day() returnsLabel { text: NatDay.nat_day() font.family: "Roboto" font.pointSize: 24 Layout.alignment: Qt.AlignHCenter renderType: Text.QtRendering Component.onCompleted : { console.log(NatDay.nat_day()) } }
you can also use typeOf(e) js function to check the type
-
this produces the desired result from the javascript file
console.log(ev.summary)but nothing shows up when i run the qml code?
-
@mtaylor what is ev.summary ?
can you show the js file and how you include it to you qml ?@mtaylor said in help with js and qml:
nothing shows up
make sure it is called somewhere
-
the original post shows the qml code, the import js and qml
text: NatDay.nat_day()
i have tried using the JS var directly but causes errorhere are the files used
https://github.com/txhammer68/qml/blob/master/nat-day2.js
https://github.com/txhammer68/qml/blob/master/Clock.qml -
is there an app to test qml code? to see the the output errors?
i have qt creator but do not see the option for qml...
i am novice at this, just like playing around with my system
thanks -
@mtaylor in qt creator there is a Application output tab
@mtaylor said in help with js and qml:
JS
is it pure js or node js ?
-
@lelev
using node with ical
i run it in console with node nat-day2.js -
you can not call node js code from qml directly.
you can use QProcess to run your scripts
or search on google how to integrate node js with qt (i have no exp in that)