psp1 psp1 - 1 year ago 155
Javascript Question

Can we declare global variable in QML file?

I want to do something similer to following code:

import QtQuick 1.0
var globalforJs =10;

function increment() // JavaScript function
QML Code

Can we have global variable in
QML file
and access it from the JavaScript function?

Answer Source

Try property int globalForJs: 10;

If you want a variable that can take any type:

property var globalForJs: 10

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download