http://doc.qt.io/qt-5/qabstractlistmodel.html
Header: | #include <QAbstractListModel> |
qmake: | QT += core |
Inherits: | QAbstractItemModel |
Inherited By: |
virtual bool |
dropMimeData(const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent) |
virtual Qt::ItemFlags |
flags(const QModelIndex & index) const |
virtual QModelIndex |
index(int row, int column = 0, const QModelIndex & parent = QModelIndex()) const |
virtual QModelIndex |
sibling(int row, int column, const QModelIndex & idx) const |
If you need to use a number of list models to manage data, it may be more appropriate to subclass QAbstractTableModel instead.
- An insertRows() implementation must call beginInsertRows() before inserting new rows into the data structure, and it must call endInsertRows() immediately afterwards.
- A removeRows() implementation must call beginRemoveRows() before the rows are removed from the data structure, and it must call endRemoveRows() immediately afterwards.
Note: Some general guidelines for subclassing models are available in the Model Subclassing Reference.
See also Model Classes, Model Subclassing Reference, QAbstractItemView, QAbstractTableModel, and Item Views Puzzle Example.
Model Subclassing Reference
- Item data handling: All models need to implement functions to enable views and delegates to query the dimensions of the model, examine items, and retrieve data.
- Navigation and index creation: Hierarchical models need to provide functions that views can call to navigate the tree-like structures they expose, and obtain model indexes for items.
- Drag and drop support and MIME type handling: Models inherit functions that control the way that internal and external drag and drop operations are performed. These functions allow items of data to be described in terms of MIME types that other components and applications can understand.
QHash<int, QByteArray> QAbstractItemModel::roleNames() const [virtual]
Qt Role | QML Role Name |
---|---|
Qt::DisplayRole | display |
Qt::DecorationRole | decoration |
Qt::EditRole | edit |
Qt::ToolTipRole | toolTip |
Qt::StatusTipRole | statusTip |
Qt::WhatsThisRole | whatsThis |
단어
'Qt' 카테고리의 다른 글
멋진 플레이어 (0) | 2015.11.16 |
---|---|
QML_Binding C++ (0) | 2015.11.12 |
Qt 에서 이벤트 처리하기 event (0) | 2015.10.30 |
Q_ENUMS (0) | 2015.10.26 |
QQuickView 옵션 (0) | 2015.10.26 |