-
Notifications
You must be signed in to change notification settings - Fork 89
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
Assigning/binding custom property types within qml. #29
Comments
Thanks for reporting. I believe (not 100%sure) that the problem is that the Slice is registered twice as different QMetaType. The first time it is register with you calling Ideally, registering twice with the same name should merge both type internally within Qt. But apparently this is not the case. I'll try to have a look next week. |
Thanks for looking into this. I just thought a little about how something like this could be tested. It would work either by using a timeout and a qml file which quits on completion, or by reading the stdout/err and recognizing errors or if there would be some kind of "crash on error" mode for the qml engine, but I could not find anything (it could maybe added into the wrapper, though). There is a warning() signal of the qml engine that can maybe hooked into. I'll see if I can find some time to look into that. |
So the problem is, actually, that the RefCell property are in fact, read-only. Maybe one could also support QPointer or Rc or some kind of pointer to object as property. But this is not yet implemented. |
Support for QPointer property as just been added. |
I'm trying to do something similar with QVariant: a listmodel that returns instances of another listmodel as data (which has to return QVariant`). The object I get:
The model I'm trying to return is similar to the SimpleListModel, I've tried both impl Clone for TagListModel {
fn clone(&self) -> Self {
Self::new()
}
}
impl QMetaType for TagListModel {}
...
TagListModel::register(Some(&CString::new("TagListModel").unwrap())); What's the equivalent of |
(I created a minimal example which may be helpful to take a closer look. This uses the normal qmetaobject version from crates.io. All code snippets here are excerpts from this repo.)
So I created two types inheriting from QQuickItem. One should be a property from the other. I've done this via a RefCell as you told me in #26 .
While this compiles, QML does throw runtime errors. This is the QML file (without imports):
So, the following things do currently not work:
From the tutorial and other qt docs I found, I was not able to derive whats wrong/missing, and in this area the examples and documentation of qmetaobject is getting thin. I'd love to work on the docs as soon as I finished what I began (and understand it ;) ).
The text was updated successfully, but these errors were encountered: