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

Move QObject type & property into extern "RustQt" #559

Closed
2 tasks done
LeonMatthesKDAB opened this issue May 29, 2023 · 5 comments
Closed
2 tasks done

Move QObject type & property into extern "RustQt" #559

LeonMatthesKDAB opened this issue May 29, 2023 · 5 comments
Assignees
Labels
👷 refactor Something needs to change 🥳🎉 1.0 This issue is part of stabilization for 1.0 release

Comments

@LeonMatthesKDAB
Copy link
Collaborator

LeonMatthesKDAB commented May 29, 2023

As discussed in #555

  • Move the struct definition outside the bridge
  • Use a declaration inside the extern "RustQt" block.
@LeonMatthesKDAB LeonMatthesKDAB added 🥳🎉 1.0 This issue is part of stabilization for 1.0 release 👷 refactor Something needs to change labels May 29, 2023
@ahayzen-kdab
Copy link
Collaborator

Note that once there is a type MyObjectQt = super::MyObject; or whatever syntax that ends up with.

The ForeignItemFn in extern "RustQt" can be just passed through in the generator rust phase to the inner extern "Rust" block, as the self type is then correct. We don't need to store the self type and rebuild the function.

@ahayzen-kdab
Copy link
Collaborator

Although note we still have the wrapper fun coming from C++ -> Rust, so maybe this can't be removed for invokables.

For inherit and signals going the other way though this should be possible.

@ahayzen-kdab ahayzen-kdab self-assigned this Jun 12, 2023
@ahayzen-kdab
Copy link
Collaborator

First step is to move the qproperty attribute from the fields onto the struct.

Then once that is done, we can move the struct outside the bridge and type alias with the qproperty attribute inside.

ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jun 12, 2023
As we move qproperty to an attribute we need to disable generating
helpers for fields as we won't be able to find them when the struct
is outside the bridge.

There are three options going forwards
- let the developer create their own getters/setters (this commit)
- add a #[field(T, NAME)] as an attribute to the qobject later
- remove the (un)safe for qproperty with notify so that rust_mut is safe

Related to KDAB#559
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jun 12, 2023
This is a stepping stone to moving qproperty to be defined
on the type in the extern "RustQt" block.

Related to KDAB#559
@ahayzen-kdab
Copy link
Collaborator

We might be able to turn the parser phase here into something more like a continuous ParseStream, but would be a larger refactor.

ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jun 13, 2023
As we move qproperty to an attribute we need to disable generating
helpers for fields as we won't be able to find them when the struct
is outside the bridge.

There are three options going forwards
- let the developer create their own getters/setters (this commit)
- add a #[field(T, NAME)] as an attribute to the qobject later
- remove the (un)safe for qproperty with notify so that rust_mut is safe

Related to KDAB#559
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jun 13, 2023
As we move qproperty to an attribute we need to disable generating
helpers for fields as we won't be able to find them when the struct
is outside the bridge.

There are three options going forwards
- let the developer create their own getters/setters (this commit)
- add a #[field(T, NAME)] as an attribute to the qobject later
- remove the (un)safe for qproperty with notify so that rust_mut is safe

Related to KDAB#559
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jun 13, 2023
This is a stepping stone to moving qproperty to be defined
on the type in the extern "RustQt" block.

Related to KDAB#559
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jun 13, 2023
As we move qproperty to an attribute we need to disable generating
helpers for fields as we won't be able to find them when the struct
is outside the bridge.

There are three options going forwards
- let the developer create their own getters/setters (this commit)
- add a #[field(T, NAME)] as an attribute to the qobject later
- remove the (un)safe for qproperty with notify so that rust_mut is safe

Related to KDAB#559
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jun 13, 2023
This is a stepping stone to moving qproperty to be defined
on the type in the extern "RustQt" block.

Related to KDAB#559
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jun 13, 2023
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jun 13, 2023
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jun 13, 2023
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jun 13, 2023
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jun 13, 2023
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jun 13, 2023
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jun 13, 2023
As rust_mut is now safe.

Related to KDAB#559
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jun 21, 2023
This is a stepping stone to moving qproperty to be defined
on the type in the extern "RustQt" block.

Related to KDAB#559
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jun 21, 2023
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jun 21, 2023
ahayzen-kdab added a commit that referenced this issue Jun 21, 2023
As we move qproperty to an attribute we need to disable generating
helpers for fields as we won't be able to find them when the struct
is outside the bridge.

There are three options going forwards
- let the developer create their own getters/setters (this commit)
- add a #[field(T, NAME)] as an attribute to the qobject later
- remove the (un)safe for qproperty with notify so that rust_mut is safe

Related to #559
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jul 17, 2023
Be-ing pushed a commit that referenced this issue Jul 17, 2023
This is a stepping stone to moving qproperty to be defined
on the type in the extern "RustQt" block.

Related to #559
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jul 17, 2023
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jul 17, 2023
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jul 17, 2023
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jul 18, 2023
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jul 18, 2023
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jul 18, 2023
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jul 18, 2023
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jul 18, 2023
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jul 18, 2023
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jul 18, 2023
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jul 18, 2023
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jul 18, 2023
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jul 18, 2023
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jul 18, 2023
Although not sure it's worth the gain as we still
need to generate the other methods from the same info.

Related to KDAB#559
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jul 18, 2023
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jul 19, 2023
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Jul 19, 2023
@ahayzen-kdab
Copy link
Collaborator

This is done now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👷 refactor Something needs to change 🥳🎉 1.0 This issue is part of stabilization for 1.0 release
Projects
None yet
Development

No branches or pull requests

2 participants