-
Notifications
You must be signed in to change notification settings - Fork 88
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
Add qml_register_uncreatable_type #227
base: master
Are you sure you want to change the base?
Conversation
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.
Thanks for the patch! This looks good.
The only detail is the last creation_reason parameter, which should be a QString
qmetaobject/src/qtdeclarative.rs
Outdated
uri: &CStr, | ||
version_major: u32, | ||
version_minor: u32, | ||
qml_name: &CStr, | ||
no_creation_reason: &CStr, |
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.
This should be a QString, since it is a user visible string, and that's also what Qt uses.
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.
Ah, you're right. I was following the pattern of the other CStr arguments, but Qt does seem to use both raw C strings and QStrings for whatever reason.
Fixed.
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.
since it is a user visible string
I don't think that argument is really any valid, to be honest :)
Can't imagine a user reading the "uncreatable type" error at runtime.
This allows for registering structs that don't implement Default, mirroring C++'s QQmlEngine::qmlRegisterUncreatableType.
qmetaobject/src/qtdeclarative.rs
Outdated
listName[listLen+nameLen+1] = '\0';*/ | ||
// END | ||
|
||
int parserStatusCast = meta_object && qmeta_inherits(meta_object, &QQuickItem::staticMetaObject) |
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.
@ogoffart Why would we even need a parserStatus for uncreatable types?
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.
I was just following qml_register_type. I replace this with -1, which seems to be the default. Can you confirm that it's correct?
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.
Ping, can you confirm that the default value of -1 is correct here?
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.
I don't know. The Qt code does put a value there but i don't know if it is usefull.
The type might not be created by QML but maybe it can still be cast? I have no idea
Is there any update on this PR? |
This allows for registering structs that don't implement Default, mirroring C++'s QQmlEngine::qmlRegisterUncreatableType.
All of the qmetaobject crate tests pass, but I didn't run tests in any other sub-crates.