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

examples: use enum in list model #633

Closed
wants to merge 1 commit into from

Conversation

ahayzen-kdab
Copy link
Collaborator

Related to #34

@ahayzen-kdab
Copy link
Collaborator Author

Need to try out making a Q_ENUM or Q_ENUM_NS as well, however Q_ENUM may not be possible as it is outside the class ?

We should consider what QML support we want here.

Copy link
Collaborator

@LeonMatthesKDAB LeonMatthesKDAB left a comment

Choose a reason for hiding this comment

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

nice 👍

@ahayzen-kdab ahayzen-kdab changed the title WIP: examples: use enum in list model examples: use enum in list model Jul 28, 2023
@@ -158,6 +158,15 @@ pub mod qobject {
}
// ANCHOR_END: book_inherit_can_fetch_more_signature

/// Roles for the QAbstractListModel
#[repr(i32)]
enum Roles {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As this is only used on the Rust side and not the C++/QML side, do we actually need to declare this as a shared enum ?

Or is this good to demo that they could cast the Roles::Id in C++ to an int and that would then work with the data method or if we could later expose that as a QML enum it would work ?

@ahayzen-kdab
Copy link
Collaborator Author

Closing in favour of #663

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.

None yet

2 participants