qml-rust icon indicating copy to clipboard operation
qml-rust copied to clipboard

trait for QAbstractItemModel

Open vandenoever opened this issue 8 years ago • 0 comments
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).

vandenoever avatar Feb 19 '17 09:02 vandenoever