qml-rust
qml-rust copied to clipboard
trait for QAbstractItemModel
trafficstars
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).