JS Objects
While working with JS there are some objects and methods which are more frequently used. This is a small collection of them.
Math.floor(v)
,Math.ceil(v)
,Math.round(v)
- largest, smallest, rounded integer from floatMath.random()
- create a random number between 0 and 1Object.keys(o)
- get keys from object (including QObject)JSON.parse(s)
,JSON.stringify(o)
- conversion between JS object and JSON stringNumber.toFixed(p)
- fixed precision floatDate
- Date manipulation
You can find them also at: JavaScript reference
Here some small and limited examples of how to use JS with QML. They should give you an idea how you can use JS inside QML
Print all keys from QML Item
Parse an object to a JSON string and back
Current Date
Call a function by name
Last updated