Use traits to define inheritance impls #270
Unanswered
ahayzen-kdab
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Current
To define a different base class you need to
#[cxx_qt::qobject(base = "QAbstractListModel")]
)include!(<QtCore/QAbstractListModel>);
#[qinvokable(cxx_override = "true")]
)fn beginInsertRows(self: Pin<&mut MyModel>, first: i32, last: i32);
This looks something like
Current Problems
Possible Solution
First you would need to define the trait somewhere (or from cxx-qt-lib)
This can then be implemented onto the QObject struct
Then when parsing the module, if we spot these traits we can
override
?This has the advantage of rust-analyzer being able to pick up the errors before compiling and is more idomatic to Rust.
Possible Solution Problems
include!(<QtCore/QAbstractListModel>);
to their bridge?fn beginInsertRows(self: Pin<&mut MyModel>, first: i32, last: i32);
to their bridge?)impl Default for MyModel
andimpl QAbstractListModel for MyModel
?#[cxx_qt::impl]
or something#[cxx_name = "AnotherName"]
above the impl be enough?cc @nico264
Beta Was this translation helpful? Give feedback.
All reactions