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

cxx-qt-gen: use impl qobject::T to define the C++ context #276

Merged
merged 1 commit into from
Oct 6, 2022

Conversation

ahayzen-kdab
Copy link
Collaborator

This then creates a natural way to add methods to the C++ context.

It also means later with nested objects they can be referred to by crates::module::qobject::MyObject.

And any Rust traits or methods are natural as they are impl A for T, with traits for the C++ object being natural with impl A for qobject::T

Be-ing
Be-ing previously approved these changes Oct 6, 2022
Copy link
Contributor

@Be-ing Be-ing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I liked the impl cxx_qt::QObject<T> but I understand the issues with it. impl qobject::T feels backwards; I would prefer impl T::qobject. Maybe there would be a way to do that with associated types, but I also understand the issues that would bring up as discussed in #237.

@Be-ing Be-ing force-pushed the use-qobject-mod-for-cpp-context branch from add45c0 to 9576f44 Compare October 6, 2022 14:03
@Be-ing Be-ing enabled auto-merge (rebase) October 6, 2022 14:06
@Be-ing Be-ing force-pushed the use-qobject-mod-for-cpp-context branch from 9576f44 to e29a724 Compare October 6, 2022 14:16
Be-ing
Be-ing previously approved these changes Oct 6, 2022
@Be-ing
Copy link
Contributor

Be-ing commented Oct 6, 2022

As a follow-up, it would be good to have a test using a QObject type from one cxx-qt module in another cxx-qt module.

@ahayzen-kdab
Copy link
Collaborator Author

As a follow-up, it would be good to have a test using a QObject type from one cxx-qt module in another cxx-qt module.

This is something to figure out in 0.5 #299 as we might need more API we'll see (eg types to define ownership). But in theory the API is now close.

This then creates a natural way to add methods to the C++ context.

It also means later with nested objects they can be referred to
by crates::module::qobject::MyObject.

And any Rust traits or methods are natural as they are impl A for T,
with traits for the C++ object being natural with impl A for qobject::T
@Be-ing Be-ing merged commit da67857 into KDAB:main Oct 6, 2022
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

Successfully merging this pull request may close these issues.

Improve C++ context API so that it matches nested objects later
2 participants