6.0.0-rc4Source

QAbstractListModel Class

The QAbstractListModel class provides an abstract model that can be subclassed to create one-dimensional list models. More…

Header#include <QAbstractListModel>
CMaketarget_link_libraries(app PRIVATE Nt::Core)
ModuleNt Core C++ Classes
InheritsQAbstractItemModel
Inherited byQStringListModel

List of all members, including inherited members

Public Functions

Reimplemented Public Functions

QModelIndexindex(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const
QModelIndexsibling(int row, int column, const QModelIndex &idx) const
booldropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
Qt::ItemFlagsflags(const QModelIndex &index) const

Detailed Description

A list model has one column of items without children. Subclasses implement rowCount() and data().

See also QStringListModel and QAbstractItemModel.

Differences from Qt

None.

Member Function Documentation

[explicit] QAbstractListModel::QAbstractListModel(QObject *parent = nullptr)

Constructs a list model with the given parent.

[override] QAbstractListModel::~QAbstractListModel()

Destroys the list model.

[override] bool QAbstractListModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)

Reimplements QAbstractItemModel::dropMimeData().

Drops data with action at row and column under parent.

[override] Qt::ItemFlags QAbstractListModel::flags(const QModelIndex &index) const

Reimplements QAbstractItemModel::flags().

Returns the flags of the item at index, with Qt::ItemNeverHasChildren.

[override] QModelIndex QAbstractListModel::index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const

Reimplements QAbstractItemModel::index().

Returns the index of row in column 0, or an invalid index if it is out of range or parent is valid.

[override] QModelIndex QAbstractListModel::sibling(int row, int column, const QModelIndex &idx) const

Reimplements QAbstractItemModel::sibling().

Returns the index at row and column next to idx.