Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to retrieve Ruby instance by ID from QML root JSObject? #42

Open
coezbek opened this issue Nov 23, 2019 · 0 comments
Open

How to retrieve Ruby instance by ID from QML root JSObject? #42

coezbek opened this issue Nov 23, 2019 · 0 comments

Comments

@coezbek
Copy link
Contributor

coezbek commented Nov 23, 2019

Is there an easy way to get the Ruby object instance from a loaded qml file?

For instance how can we get the FizzBuzz instance that is created from Fizzbuzz.qml?

We might be able to use something like this:

QML.application.root.to_hash["data"].to_hash["0"].unwrap

But this would require some guess-work, because it depends on the order of components under the root object.

Is there away use findChild as would be the solution when using C++?

Could you add an example to the docs?

(btw: is there a way to get root.to_hash["data"] to return an array rather than a hash?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant