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

Defining nested objects with the new API #299

Closed
ahayzen-kdab opened this issue Oct 3, 2022 · 2 comments · Fixed by #367
Closed

Defining nested objects with the new API #299

ahayzen-kdab opened this issue Oct 3, 2022 · 2 comments · Fixed by #367
Assignees
Labels
🤔 discussion Feedback welcome ⬆️ feature New feature or request
Milestone

Comments

@ahayzen-kdab
Copy link
Collaborator

ahayzen-kdab commented Oct 3, 2022

Defining nested objects with the new API probably two types to consider

  • Owned by C++/Qt
  • Owned by Rust

Could have a separate type for owned by C++ ? So that Drop doesn't deconstruct it.

Can raw pointers, shared pointers, or unique pointers be used for any of these?

How do we know it's a QObject pointer and not a CXX type ?

Should we have QPointer and QOwnedPointer as the "magic" types ?

What types does QML expect/accept when it's a pointer?

Can we return a nested object from an invokable ? What does this mean ? Who has ownership ?

Ensure that one object would be able to call into another object by maybe borrowing (for the locks as rust/rust_mut don't lock? maybe they should now that we use a recursive_mutex?)

@ahayzen-kdab
Copy link
Collaborator Author

Do we even need owned by Rust initially ? Or would supporting Q_PROPERTY(AnotherObject* other READ other WRITE setOther NOTIFY otherChanged) via something like other: *mut crate::mod::qobject::AnotherObject be enough ? What does the Default impl look like in this case?

Can owned by Rust properties get away with just being UniquePtr/SharedPtr and then if you want to reach those in QML add some getters in the C++ to convert to a raw pointer?

@LeonMatthesKDAB
Copy link
Collaborator

Do we even need owned by Rust initially ? Or would supporting Q_PROPERTY(AnotherObject* other READ other WRITE setOther NOTIFY otherChanged) via something like other: *mut crate::mod::qobject::AnotherObject be enough ? What does the Default impl look like in this case?

Can owned by Rust properties get away with just being UniquePtr/SharedPtr and then if you want to reach those in QML add some getters in the C++ to convert to a raw pointer?

I think that would be enough for now.
Default would just set the ptr to nullptr 🤷 .

ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Nov 28, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Nov 28, 2022
@ahayzen-kdab ahayzen-kdab self-assigned this Nov 28, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Nov 28, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Nov 28, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 1, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 1, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 1, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 2, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 2, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 2, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 2, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 2, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 2, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 2, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 5, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 5, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 5, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 5, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 5, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 6, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 6, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 6, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 6, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 6, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 6, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 7, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 7, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 8, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 19, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 19, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 19, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 19, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 20, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jan 5, 2023
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jan 5, 2023
przempore pushed a commit to przempore/cxx-qt that referenced this issue Mar 15, 2023
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants