QAbstractListModel Class
The QAbstractListModel class provides an abstract model that can be subclassed to create one-dimensional list models. More…
| Header | #include <QAbstractListModel> |
|---|---|
| CMake | target_link_libraries(app PRIVATE Nt::Core) |
| Module | Nt Core C++ Classes |
| Inherits | QAbstractItemModel |
| Inherited by | QStringListModel |
List of all members, including inherited members
Public Functions
| QAbstractListModel(QObject *parent = nullptr) | |
| ~QAbstractListModel() |
Reimplemented Public Functions
| QModelIndex | index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const |
| QModelIndex | sibling(int row, int column, const QModelIndex &idx) const |
| bool | dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) |
| Qt::ItemFlags | flags(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
QAbstractListModel::QAbstractListModel(QObject *parent = nullptr)
Constructs a list model with the given parent.
QAbstractListModel::~QAbstractListModel()
Destroys the list model.
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.
Qt::ItemFlags QAbstractListModel::flags(const QModelIndex &index) const
Reimplements QAbstractItemModel::flags().
Returns the flags of the item at index, with Qt::ItemNeverHasChildren.
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.
QModelIndex QAbstractListModel::sibling(int row, int column, const QModelIndex &idx) const
Reimplements QAbstractItemModel::sibling().
Returns the index at row and column next to idx.