Skip to content
This repository has been archived by the owner on Feb 17, 2021. It is now read-only.

trait for QAbstractItemModel #37

Open
vandenoever opened this issue Feb 19, 2017 · 0 comments
Open

trait for QAbstractItemModel #37

vandenoever opened this issue Feb 19, 2017 · 0 comments

Comments

@vandenoever
Copy link

QAbstractItemModel is the bread and butter of QML. It would be great if they could be created in Rust via a trait. A minimal trait would look like this:

trait QAbstractItemModel {
    fn column_count(&self, parent: QModelIndex) -> i32;
    fn data(&self, index: QModelIndex, role: i32) -> QVariant;
    fn index(&self, row: i32, column: i32, parent: QModelIndex) -> QModelIndex;
    fn parent(&self, index: QModelIndex) -> QModelIndex;
    fn row_count(&self, parent: QModelIndex) -> i32;
}

role could be an enum. Since QModelIndex is the same size as a reference, they're passes by value. (I guess QModelIndex can implement Copy trait).

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

No branches or pull requests

1 participant