0

I want to create a global pure JavaScript object. How can I do that?

I tried following

//some qml
var gp = { x:0, y:0}
//some qml

When I ran this QML file, I get JavaScript declaration outside Script element

1 Answer 1

2

Declarations in QML should start with property. As in:

property var gp: { x:0; y:0 }

You'll be able to access this from your JS functions. Is that what you're looking for?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.