Skip to content
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

How to use QAbstractListModel? #5

Open
crziter opened this issue Jan 31, 2020 · 3 comments
Open

How to use QAbstractListModel? #5

crziter opened this issue Jan 31, 2020 · 3 comments

Comments

@crziter
Copy link

crziter commented Jan 31, 2020

Hello,

Thank you very much for your great works! Can you provide an example of how to use QAbstractListModel with rust-qt? And further registering it to QML?

Best regards!

@Riateche
Copy link
Member

Riateche commented Feb 3, 2020

It's not currently possible to use QAbstractListModel because inheritance is not supported yet. It's possible to work around it with QStandardItemModel in simple cases.

I don't know if it's possible to register QML types from Rust right now. It may require some special support, but I haven't looked into it yet.

@jalcine
Copy link

jalcine commented Feb 20, 2020

This is me being naive, but what prevents inheritance from being supported? Is it because of a trait-y thing in Rust? I figure a Rust-side implementation of those classes can be made.

@Riateche
Copy link
Member

Nothing prevents supporting inheritance, it just wasn't implemented yet. Inheritance is a bit more complicated to support than straightforward calling of public methods because the generator has to set up an inherited class that allows to supply custom handlers for each virtual method. It should also provide a way to call protected methods because that's sometimes necessary. See rust-qt/ritual#26 for a (slightly outdated) description of a possible approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants