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

Add support for pure virtual methods #1179

Open
ahayzen-kdab opened this issue Feb 7, 2025 · 1 comment
Open

Add support for pure virtual methods #1179

ahayzen-kdab opened this issue Feb 7, 2025 · 1 comment
Assignees
Labels
🤔 discussion Feedback welcome ⬆️ feature New feature or request 🥳🎉 1.0 This issue is part of stabilization for 1.0 release

Comments

@ahayzen-kdab
Copy link
Collaborator

We should allow for defining pure virtual methods on RustQt types.

This allows for then creating an abstract QObject and implementing concrete types, for example this is useful when having a real vs mock implementation for testing (this is useful when you have an interface that talks to hardware, over a network socket, to an input device, etc).

In C++ this looks like the following

virtual T ident(...) = 0;

To represent this in Rust we could use #[cxx_pure_virtual] or combing multiple attributes so one is for virtual and one is for the = 0 ?

Once we support this the multi crate example could be a good place to have an example of one crate with an abstract/real/mock implementation and another crate using the abstract version as the type in properties/invokables, as a real world example.

Note that there is also = default in C++, so we need that too ?

@ahayzen-kdab ahayzen-kdab added ⬆️ feature New feature or request 🤔 discussion Feedback welcome 🥳🎉 1.0 This issue is part of stabilization for 1.0 release labels Feb 7, 2025
@BenFordTytherington
Copy link
Collaborator

Is this complete as of #1189?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤔 discussion Feedback welcome ⬆️ feature New feature or request 🥳🎉 1.0 This issue is part of stabilization for 1.0 release
Projects
Status: Todo
Development

No branches or pull requests

2 participants