-
Notifications
You must be signed in to change notification settings - Fork 91
Add #[derive(QEnum)] #42
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
Conversation
I see that your continuous integration tests for Qt version 5.8, 5.9 and 5.10. And they all fail... 😢 |
I guess it is best to keep using the metaobject revision version 7. |
ad20a3f
to
8fb8d78
Compare
@@ -445,7 +455,8 @@ pub struct QMetaObject { | |||
pub superdata: *const QMetaObject, | |||
pub string_data: *const u8, | |||
pub data: *const u32, | |||
pub static_metacall: extern "C" fn(o: *mut c_void, c: u32, idx: u32, a: *const *mut c_void), | |||
pub static_metacall: | |||
Option<extern "C" fn(o: *mut c_void, c: u32, idx: u32, a: *const *mut c_void)>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the Option<>
has the same size as the exten fn, that's perfectly fine and there is no bug in rust.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extern "C" fn
seems to be not nullable, so Option<extern "C" fn>
should be optimized to the same size. I will check that they do.
From the link I posted, it appears to be the way to go about it.
At least the tests run just fine...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, works for me in version 7 after removing the alias. Thanks |
Looks great! |
Only add the meta-object, not the property support:
Enum values are stored in an array of
u32
, so 32 is the maximal size that will correctly work (moc doesn't check...). So I choice to force the use of the attribute#[repr(*)]
limited tou8, u16, u32, i8, i16, i32
.I needed to change
QMetaObject.static_metacall
to an option type as anextern "C" fn
pointer can not be set to null (see rust-lang/rust#8730). The namespace meta-object doesn't have an associatedstatic_metacall
function so we need to be able to set it to null.I work with Qt 5.12.1 so my moc output example is in version 8. I had to bump the version from 7 to 8 to make it work. I don't know if it possible to make it work in version 7.
I'm still working on the property part.