diff --git a/src/lib/QtCore/QAbstractItemModel.ts b/src/lib/QtCore/QAbstractItemModel.ts index 920c6b846..e33bd3cd3 100644 --- a/src/lib/QtCore/QAbstractItemModel.ts +++ b/src/lib/QtCore/QAbstractItemModel.ts @@ -105,20 +105,17 @@ export class QAbstractItemModel extends NodeObject { this.native.initNodeDispatcher(dispatcher); } + // *** Public Functions *** + buddy(child: QModelIndex): QModelIndex { return new QModelIndex(this.native._super_buddy(child.native)); } - index(row: number, column: number, parent = new QModelIndex()): QModelIndex { - return new QModelIndex(); - } + // TODO: virtual bool canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const + // TODO: virtual bool canFetchMore(const QModelIndex &parent) const - parent(child: QModelIndex): QModelIndex { - return new QModelIndex(); - } - - rowCount(parent = new QModelIndex()): number { - return 0; + checkIndex(index: QModelIndex): boolean { + return this.native.checkIndex(index.native); } columnCount(parent = new QModelIndex()): number { @@ -129,32 +126,107 @@ export class QAbstractItemModel extends NodeObject { return new QVariant(); } - hasIndex(row: number, column: number, parent = new QModelIndex()): boolean { - return this.native.hasIndex(row, column, parent.native); - } - - createIndex(row: number, column: number): QModelIndex { - const result = this.native.createIndex(row, column); - return new QModelIndex(result); - } - - checkIndex(index: QModelIndex): boolean { - return this.native.checkIndex(index.native); - } + // TODO: virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) + // TODO: virtual void fetchMore(const QModelIndex &parent) flags(index: QModelIndex): ItemFlag { return this.native._super_flags(index.native); } - emitDataChanged(topLeft: QModelIndex, bottomRight: QModelIndex, roles: ItemDataRole[]): void { - this.native.emitDataChanged(topLeft.native, bottomRight.native, roles); + // TODO: virtual bool hasChildren(const QModelIndex &parent = QModelIndex()) const + + hasIndex(row: number, column: number, parent = new QModelIndex()): boolean { + return this.native.hasIndex(row, column, parent.native); } headerData(section: number, orientation: Orientation, role: number): QVariant { return new QVariant(); } + index(row: number, column: number, parent = new QModelIndex()): QModelIndex { + return new QModelIndex(); + } + + // TODO: bool insertColumn(int column, const QModelIndex &parent = QModelIndex()) + // TODO: virtual bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex()) + // TODO: bool insertRow(int row, const QModelIndex &parent = QModelIndex()) + // TODO: virtual bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) + // TODO: virtual QMap itemData(const QModelIndex &index) const + // TODO: virtual QModelIndexList match(const QModelIndex &start, int role, const QVariant &value, int hits = 1, Qt::MatchFlags flags = Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const + // TODO: virtual QMimeData * mimeData(const QModelIndexList &indexes) const + // TODO: virtual QStringList mimeTypes() const + // TODO: bool moveColumn(const QModelIndex &sourceParent, int sourceColumn, const QModelIndex &destinationParent, int destinationChild) + // TODO: virtual bool moveColumns(const QModelIndex &sourceParent, int sourceColumn, int count, const QModelIndex &destinationParent, int destinationChild) + // TODO: bool moveRow(const QModelIndex &sourceParent, int sourceRow, const QModelIndex &destinationParent, int destinationChild) + // TODO: virtual bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild) + + parent(child: QModelIndex): QModelIndex { + return new QModelIndex(); + } + + // TODO: bool removeColumn(int column, const QModelIndex &parent = QModelIndex()) + // TODO: virtual bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()) + // TODO: bool removeRow(int row, const QModelIndex &parent = QModelIndex()) + // TODO: virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) + // TODO: virtual QHash roleNames() const + + rowCount(parent = new QModelIndex()): number { + return 0; + } + setData(index: QModelIndex, value: QVariant, role = ItemDataRole.EditRole): boolean { return false; } + + // TODO: virtual bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole) + // TODO: virtual bool setItemData(const QModelIndex &index, const QMap &roles) + // TODO: virtual QModelIndex sibling(int row, int column, const QModelIndex &index) const + // TODO: virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) + // TODO: virtual QSize span(const QModelIndex &index) const + // TODO: virtual Qt::DropActions supportedDragActions() const + // TODO: virtual Qt::DropActions supportedDropActions() const + + // *** Public Slots *** + + // TODO: virtual void revert() + // TODO: virtual bool submit() + + // *** Signals *** + + // Note: Many signals don't need to be explicitly emitted by subclasses and can be safely omitted. + + emitDataChanged(topLeft: QModelIndex, bottomRight: QModelIndex, roles: ItemDataRole[]): void { + this.native.emitDataChanged(topLeft.native, bottomRight.native, roles); + } + + // TODO: void headerDataChanged(Qt::Orientation orientation, int first, int last) + // TODO: void layoutAboutToBeChanged(const QList &parents = QList(), QAbstractItemModel::LayoutChangeHint hint = QAbstractItemModel::NoLayoutChangeHint) + // TODO: void layoutChanged(const QList &parents = QList(), QAbstractItemModel::LayoutChangeHint hint = QAbstractItemModel::NoLayoutChangeHint) + + // *** Protected Functions *** + + // TODO: void beginInsertColumns(const QModelIndex &parent, int first, int last) + // TODO: void beginInsertRows(const QModelIndex &parent, int first, int last) + // TODO: bool beginMoveColumns(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationChild) + // TODO: bool beginMoveRows(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationChild) + // TODO: void beginRemoveColumns(const QModelIndex &parent, int first, int last) + // TODO: void beginRemoveRows(const QModelIndex &parent, int first, int last) + // TODO: void beginResetModel() + // TODO: void changePersistentIndex(const QModelIndex &from, const QModelIndex &to) + // TODO: void changePersistentIndexList(const QModelIndexList &from, const QModelIndexList &to) + + createIndex(row: number, column: number): QModelIndex { + const result = this.native.createIndex(row, column); + return new QModelIndex(result); + } + + // TODO: QModelIndex createIndex(int row, int column, quintptr id) const + // TODO: void endInsertColumns() + // TODO: void endInsertRows() + // TODO: void endMoveColumns() + // TODO: void endMoveRows() + // TODO: void endRemoveColumns() + // TODO: void endRemoveRows() + // TODO: void endResetModel() + // TODO: QModelIndexList persistentIndexList() const }