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

Wrapping existing QObjects? #290

Open
Supreeeme opened this issue Jun 19, 2023 · 2 comments
Open

Wrapping existing QObjects? #290

Supreeeme opened this issue Jun 19, 2023 · 2 comments

Comments

@Supreeeme
Copy link

Supreeeme commented Jun 19, 2023

The guidance in the README seems to be around creating your own QObjects from Rust. But is there any way to wrap a QObject in Qt's library that isn't currently in qmetaobject? Namely, I'm interested in being able to connect to their signals/slots, and as far as I'm aware cpp_class! does not provide this.

@ogoffart
Copy link
Member

There is the current doc for that: https://github.com/woboq/qmetaobject-rs#what-if-a-wrapper-for-the-qt-c-api-is-missing
And you can look at the source code of the crate for examples.

@Supreeeme
Copy link
Author

The example in the docs seems to show creating a new QObject from Rust, but I want to use one that already exists from C++. I see the QObjects that come with the library are wrapped withcpp_class!, but none of them implement the QObject trait. Is it possible to get an implementation of this trait for something wrapped with cpp_class!?

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

2 participants