Hello Mansour,
Of course, I'll share some easy-to-follow tutorials and samples. It should take about 2–3 days before I release this useful library (hopefully before the new Ring version is launched).
The concept is simple: you have a JS object called Ring. Everything you want to do with Ring is done by calling its methods. For example:
- Get a global Ring variable containing text:
Use Ring.getVar("cVarName")
Example for button text:
button {
text: Ring.getVar("G_MainBtnText")
}
- Call a Ring event (no return value):
Use Ring.callEvent("cEvent")
- Call a Ring function and pass parameters from QML:
Use Ring.callFunc("cFuncName", aParams)
Example:
console.log(Ring.callFunc("substr", ["Ring and QML", " ", "_"])) // Output: Ring_and_QML
Key details:
- You can call any Ring function (not just built-ins).
- Parameters can be: QML objects, strings, numbers (int, double, bool), or JSON arrays.
- Return types from Ring: strings, numbers, JSON objects, or JavaScript arrays (as JSON objects).
This isn’t all—more features are coming once development is complete!
From the Ring side:
- Share QWidget objects with QML and interact with them.
- Retrieve a QML object by its objectName property.
- Update QML properties directly from Ring.
These aren’t all the features I’ve completed—there’s much more to come!
Note:my message enhanced by AI
Best wishes,
Mohannad