-
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
QColor member results in error. #26
Comments
QColor need to iimplement QMetaType. |
I added the missing QMetaType declaration in commit ec11955 |
I see, thanks for that. Now, I have an additional question to that: I have a similar problem with a custom type, I'm not sure whether to open another issue for that. I am currently trying to replicate chapter 4 of this c++ example where they create a I assume I can somehow work around that and render everything using the PieChart class itself (Slices could be QGadgets or so), but that would not really be what they to in the tutorial. So the question is: Is there an intended way to solve this problem for custom types with a base class in qmetaobject? I am not sure whether I have overseen something in the examples, but I think this is a relatively common case. I am not sure whether I could implement it more similar to QColor or so. Maybe it would work somehow, but a more standard/intended/tutorial-like way would be nice. |
Well, the trait to use a property is, in fact, |
That makes sense, thanks. Well, now it is at least documented here, and I'll look into documenting things as soon I've gotten further. I have to say that most time I need for this demo is to get the cpp! macros working. I did what you explained, and it works, but for QQuickPaintedItems I need to use the setParentItem(...) function, but I can't get it to work. I do not think that this is related to this issue (it compiles without this cpp macro), but it may be. fn set_pieslice(&mut self, mut pieslice: RefCell<PieSlice>) {
{
let slice_obj = pieslice.get_mut().get_cpp_object();
let self_obj = self.get_cpp_object();
// TODO pieslice.set_parent_item(self);
unsafe {
cpp!( unsafe [self_obj as "QQuickPaintedItem*", slice_obj as "QQuickPaintedItem*"] {
slice_obj->setParentItem(self_obj);
});
}
}
self.pieslice = pieslice;
} I did not manage to implement this in a trait in an easy way, so I decided to just do it in my example crate. The error message says nothing useful. Compiling qmldemo v0.1.0 (/home/verpfeilt/Git/qmldemo)
error: proc-macro derive panicked
--> src/piechart.rs:37:17
|
37 | / cpp!( unsafe [self_obj as "QQuickPaintedItem*", slice_obj as "QQuickPaintedItem*"] {
38 | | slice_obj->setParentItem(self_obj);
39 | | });
| |___________________^
|
= help: message:
-- rust-cpp fatal error --
The OUT_DIR environment variable was not set.
NOTE: rustc must be run by Cargo.: NotPresent
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: aborting due to previous error |
I'm interrested in what could have been done to make this easier. Was it the lack of documentation? Or bad error message? |
That's a really strange error... normaly, cargo is setting this variable. |
I tried to figure out the problem, but somehow I don't get it.
This works: (Minimal example)
But this does not:
I do not see that/where QString implements QGadget or QObject, so why does it work with QString, but not with QColor? What would I need to change?
Error Message:
The text was updated successfully, but these errors were encountered: