- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Slots | Signals | Public Member Functions | Protected Member Functions | Friends

# QAbstractItemModel Class Reference

Search for all occurrences

## Detailed Description

Definition at line 159 of file qabstractitemmodel.h.

`#include <qabstractitemmodel.h>`

Inheritance diagram for QAbstractItemModel:
[legend]

List of all members.

## Public Slots
virtual bool | submit ()
virtual void | revert ()
## Signals
void | dataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight)
void | headerDataChanged (Qt::Orientation orientation, int first, int last)
void | layoutChanged ()
void | layoutAboutToBeChanged ()
## Public Member Functions
| QAbstractItemModel (QObject *parent=0)
virtual | ~QAbstractItemModel ()
bool | hasIndex (int row, int column, const QModelIndex &parent=QModelIndex()) const
virtual QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const =0
virtual QModelIndex | parent (const QModelIndex &child) const =0
QModelIndex | sibling (int row, int column, const QModelIndex &idx) const
virtual int | rowCount (const QModelIndex &parent=QModelIndex()) const =0
virtual int | columnCount (const QModelIndex &parent=QModelIndex()) const =0
virtual bool | hasChildren (const QModelIndex &parent=QModelIndex()) const
virtual QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const =0
virtual bool | setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
virtual QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
virtual bool | setHeaderData (int section, Qt::Orientation orientation, const QVariant &value, int role=Qt::EditRole)
virtual QMap< int, QVariant > | itemData (const QModelIndex &index) const
virtual bool | setItemData (const QModelIndex &index, const QMap< int, QVariant > &roles)
virtual QStringList | mimeTypes () const
virtual QMimeData * | mimeData (const QModelIndexList &indexes) const
virtual bool | dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
virtual Qt::DropActions | supportedDropActions () const
Qt::DropActions | supportedDragActions () const
void | setSupportedDragActions (Qt::DropActions)
virtual bool | insertRows (int row, int count, const QModelIndex &parent=QModelIndex())
virtual bool | insertColumns (int column, int count, const QModelIndex &parent=QModelIndex())
virtual bool | removeRows (int row, int count, const QModelIndex &parent=QModelIndex())
virtual bool | removeColumns (int column, int count, const QModelIndex &parent=QModelIndex())
bool | insertRow (int row, const QModelIndex &parent=QModelIndex())
bool | insertColumn (int column, const QModelIndex &parent=QModelIndex())
bool | removeRow (int row, const QModelIndex &parent=QModelIndex())
bool | removeColumn (int column, const QModelIndex &parent=QModelIndex())
virtual void | fetchMore (const QModelIndex &parent)
virtual bool | canFetchMore (const QModelIndex &parent) const
virtual Qt::ItemFlags | flags (const QModelIndex &index) const
virtual void | sort (int column, Qt::SortOrder order=Qt::AscendingOrder)
virtual QModelIndex | buddy (const QModelIndex &index) const
virtual QModelIndexList | match (const QModelIndex &start, int role, const QVariant &value, int hits=1, Qt::MatchFlags flags=Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const
virtual QSize | span (const QModelIndex &index) const
const QHash< int, QByteArray > & | roleNames () const
## Protected Member Functions
| QAbstractItemModel (QAbstractItemModelPrivate &dd, QObject *parent=0)
QModelIndex | createIndex (int row, int column, void *data=0) const
QModelIndex | createIndex (int row, int column, int id) const
QModelIndex | createIndex (int row, int column, quint32 id) const
void | encodeData (const QModelIndexList &indexes, QDataStream &stream) const
bool | decodeData (int row, int column, const QModelIndex &parent, QDataStream &stream)
void | beginInsertRows (const QModelIndex &parent, int first, int last)
void | endInsertRows ()
void | beginRemoveRows (const QModelIndex &parent, int first, int last)
void | endRemoveRows ()
bool | beginMoveRows (const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationRow)
void | endMoveRows ()
void | beginInsertColumns (const QModelIndex &parent, int first, int last)
void | endInsertColumns ()
void | beginRemoveColumns (const QModelIndex &parent, int first, int last)
void | endRemoveColumns ()
bool | beginMoveColumns (const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationColumn)
void | endMoveColumns ()
void | reset ()
void | beginResetModel ()
void | endResetModel ()
void | changePersistentIndex (const QModelIndex &from, const QModelIndex &to)
void | changePersistentIndexList (const QModelIndexList &from, const QModelIndexList &to)
QModelIndexList | persistentIndexList () const
void | setRoleNames (const QHash< int, QByteArray > &roleNames)
## Friends
class | QPersistentModelIndexData
class | QAbstractItemViewPrivate

## Constructor & Destructor Documentation

QAbstractItemModel | ( | QObject * | parent = `0` | ) | `[explicit]`

virtual ~QAbstractItemModel | ( |  | ) | `[virtual]`

QAbstractItemModel | ( | QAbstractItemModelPrivate & | dd,
|  | QObject * | parent = `0`
| ) |  | `[protected]`

## Member Function Documentation

bool hasIndex | ( | int | row,
|  | int | column,
|  | const QModelIndex & | parent = `QModelIndex()`
| ) |  | const

Search for all occurrences

virtual QModelIndex index | ( | int | row,
|  | int | column,
|  | const QModelIndex & | parent = `QModelIndex()`
| ) |  | const `[pure virtual]`

Search for all occurrences

Implemented in QAbstractTableModel, QAbstractListModel, QDirModel, QFileSystemModel, QProxyModel, QSortFilterProxyModel, and QStandardItemModel.

virtual QModelIndex parent | ( | const QModelIndex & | child | ) | const `[pure virtual]`

Search for all occurrences

Implemented in QDirModel, QFileSystemModel, QProxyModel, QSortFilterProxyModel, and QStandardItemModel.

QModelIndex sibling | ( | int | row,
|  | int | column,
|  | const QModelIndex & | idx
| ) |  | const `[inline]`

Search for all occurrences

Definition at line 175 of file qabstractitemmodel.h.

            { return index(row, column, parent(idx)); }

virtual int rowCount | ( | const QModelIndex & | parent = `QModelIndex()` | ) | const `[pure virtual]`

Search for all occurrences

Implemented in ObjectDescriptionModel< type >, QDirModel, QFileSystemModel, QProxyModel, QSortFilterProxyModel, QStandardItemModel, QStringListModel, QSqlQueryModel, and QSqlTableModel.

virtual int columnCount | ( | const QModelIndex & | parent = `QModelIndex()` | ) | const `[pure virtual]`

Search for all occurrences

Implemented in QDirModel, QFileSystemModel, QProxyModel, QSortFilterProxyModel, QStandardItemModel, and QSqlQueryModel.

virtual bool hasChildren | ( | const QModelIndex & | parent = `QModelIndex()` | ) | const `[virtual]`

Search for all occurrences

Reimplemented in QDirModel, QFileSystemModel, QProxyModel, QSortFilterProxyModel, and QStandardItemModel.

virtual QVariant data | ( | const QModelIndex & | index,
|  | int | role = `Qt::DisplayRole`
| ) |  | const `[pure virtual]`

Search for all occurrences

Implemented in ObjectDescriptionModel< type >, QAbstractProxyModel, QDirModel, QFileSystemModel, QProxyModel, QSortFilterProxyModel, QStandardItemModel, QStringListModel, QSqlQueryModel, QSqlRelationalTableModel, and QSqlTableModel.

virtual bool setData | ( | const QModelIndex & | index,
|  | const QVariant & | value,
|  | int | role = `Qt::EditRole`
| ) |  | `[virtual]`

Search for all occurrences

Reimplemented in QAbstractProxyModel, QDirModel, QFileSystemModel, QProxyModel, QSortFilterProxyModel, QStandardItemModel, QStringListModel, QSqlRelationalTableModel, and QSqlTableModel.

virtual QVariant headerData | ( | int | section,
|  | Qt::Orientation | orientation,
|  | int | role = `Qt::DisplayRole`
| ) |  | const `[virtual]`

Search for all occurrences

Reimplemented in QAbstractProxyModel, QDirModel, QFileSystemModel, QProxyModel, QSortFilterProxyModel, QStandardItemModel, QSqlQueryModel, and QSqlTableModel.

virtual bool setHeaderData | ( | int | section,
|  | Qt::Orientation | orientation,
|  | const QVariant & | value,
|  | int | role = `Qt::EditRole`
| ) |  | `[virtual]`

Search for all occurrences

Reimplemented in QAbstractProxyModel, QProxyModel, QSortFilterProxyModel, QStandardItemModel, and QSqlQueryModel.

virtual QMap<int, QVariant> itemData | ( | const QModelIndex & | index | ) | const `[virtual]`

Search for all occurrences

Reimplemented in QAbstractProxyModel, and QStandardItemModel.

virtual bool setItemData | ( | const QModelIndex & | index,
|  | const QMap< int, QVariant > & | roles
| ) |  | `[virtual]`

Search for all occurrences

Reimplemented in QStandardItemModel.

virtual QStringList mimeTypes | ( |  | ) | const `[virtual]`

Search for all occurrences

Reimplemented in ObjectDescriptionModel< type >, QDirModel, QFileSystemModel, QProxyModel, QSortFilterProxyModel, and QStandardItemModel.

virtual QMimeData* mimeData | ( | const QModelIndexList & | indexes | ) | const `[virtual]`

Search for all occurrences

Reimplemented in ObjectDescriptionModel< type >, QDirModel, QFileSystemModel, QProxyModel, QSortFilterProxyModel, and QStandardItemModel.

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

Search for all occurrences

Reimplemented in ObjectDescriptionModel< type >, QAbstractTableModel, QAbstractListModel, QDirModel, QFileSystemModel, QProxyModel, QSortFilterProxyModel, and QStandardItemModel.

virtual Qt::DropActions supportedDropActions | ( |  | ) | const `[virtual]`

Search for all occurrences

Reimplemented in ObjectDescriptionModel< type >, QDirModel, QFileSystemModel, QProxyModel, QSortFilterProxyModel, QStandardItemModel, and QStringListModel.

Qt::DropActions supportedDragActions | ( |  | ) | const

Search for all occurrences

void setSupportedDragActions | ( | Qt::DropActions |  | ) |

Search for all occurrences

virtual bool insertRows | ( | int | row,
|  | int | count,
|  | const QModelIndex & | parent = `QModelIndex()`
| ) |  | `[virtual]`

Search for all occurrences

Reimplemented in QProxyModel, QSortFilterProxyModel, QStandardItemModel, QStringListModel, and QSqlTableModel.

virtual bool insertColumns | ( | int | column,
|  | int | count,
|  | const QModelIndex & | parent = `QModelIndex()`
| ) |  | `[virtual]`

Search for all occurrences

Reimplemented in QProxyModel, QSortFilterProxyModel, QStandardItemModel, and QSqlQueryModel.

virtual bool removeRows | ( | int | row,
|  | int | count,
|  | const QModelIndex & | parent = `QModelIndex()`
| ) |  | `[virtual]`

Search for all occurrences

Reimplemented in ObjectDescriptionModel< type >, QSortFilterProxyModel, QStandardItemModel, QStringListModel, and QSqlTableModel.

virtual bool removeColumns | ( | int | column,
|  | int | count,
|  | const QModelIndex & | parent = `QModelIndex()`
| ) |  | `[virtual]`

Search for all occurrences

Reimplemented in QSortFilterProxyModel, QStandardItemModel, QSqlQueryModel, QSqlRelationalTableModel, and QSqlTableModel.

bool insertRow | ( | int | row,
|  | const QModelIndex & | parent = `QModelIndex()`
| ) |  | `[inline]`

Search for all occurrences

Reimplemented in QStandardItemModel.

Definition at line 310 of file qabstractitemmodel.h.

    { return insertRows(arow, 1, aparent); }

bool insertColumn | ( | int | column,
|  | const QModelIndex & | parent = `QModelIndex()`
| ) |  | `[inline]`

Search for all occurrences

Reimplemented in QStandardItemModel.

Definition at line 312 of file qabstractitemmodel.h.

    { return insertColumns(acolumn, 1, aparent); }

bool removeRow | ( | int | row,
|  | const QModelIndex & | parent = `QModelIndex()`
| ) |  | `[inline]`

Search for all occurrences

Definition at line 314 of file qabstractitemmodel.h.

    { return removeRows(arow, 1, aparent); }

bool removeColumn | ( | int | column,
|  | const QModelIndex & | parent = `QModelIndex()`
| ) |  | `[inline]`

Search for all occurrences

Definition at line 316 of file qabstractitemmodel.h.

    { return removeColumns(acolumn, 1, aparent); }

virtual void fetchMore | ( | const QModelIndex & | parent | ) | `[virtual]`

Search for all occurrences

Reimplemented in QFileSystemModel, QProxyModel, QSortFilterProxyModel, and QSqlQueryModel.

virtual bool canFetchMore | ( | const QModelIndex & | parent | ) | const `[virtual]`

Search for all occurrences

Reimplemented in QFileSystemModel, QSortFilterProxyModel, and QSqlQueryModel.

virtual Qt::ItemFlags flags | ( | const QModelIndex & | index | ) | const `[virtual]`

Search for all occurrences

Reimplemented in ObjectDescriptionModel< type >, QAbstractProxyModel, QDirModel, QFileSystemModel, QProxyModel, QSortFilterProxyModel, QStandardItemModel, QStringListModel, and QSqlTableModel.

virtual void sort | ( | int | column,
|  | Qt::SortOrder | order = `Qt::AscendingOrder`
| ) |  | `[virtual]`

Search for all occurrences

Reimplemented in QDirModel, QFileSystemModel, QProxyModel, QSortFilterProxyModel, QStandardItemModel, QStringListModel, and QSqlTableModel.

virtual QModelIndex buddy | ( | const QModelIndex & | index | ) | const `[virtual]`

Search for all occurrences

Reimplemented in QSortFilterProxyModel.

virtual QModelIndexList match | ( | const QModelIndex & | start,
|  | int | role,
|  | const QVariant & | value,
|  | int | hits = `1`,
|  | Qt::MatchFlags | flags = `Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)`
| ) |  | const `[virtual]`

Search for all occurrences

Reimplemented in QProxyModel, and QSortFilterProxyModel.

virtual QSize span | ( | const QModelIndex & | index | ) | const `[virtual]`

Search for all occurrences

Reimplemented in QProxyModel, and QSortFilterProxyModel.

const QHash<int,QByteArray>& roleNames | ( |  | ) | const

Search for all occurrences

void dataChanged | ( | const QModelIndex & | topLeft,
|  | const QModelIndex & | bottomRight
| ) |  | `[signal]`

Search for all occurrences

void headerDataChanged | ( | Qt::Orientation | orientation,
|  | int | first,
|  | int | last
| ) |  | `[signal]`

Search for all occurrences

void layoutChanged | ( |  | ) | `[signal]`

Search for all occurrences

void layoutAboutToBeChanged | ( |  | ) | `[signal]`

Search for all occurrences

virtual bool submit | ( |  | ) | `[virtual, slot]`

Search for all occurrences

Reimplemented in QAbstractProxyModel, QProxyModel, and QSqlTableModel.

virtual void revert | ( |  | ) | `[virtual, slot]`

Search for all occurrences

Reimplemented in QAbstractProxyModel, QProxyModel, and QSqlTableModel.

QModelIndex createIndex | ( | int | row,
|  | int | column,
|  | void * | data = `0`
| ) |  | const `[inline, protected]`

Search for all occurrences

Definition at line 319 of file qabstractitemmodel.h.

    { return QModelIndex(arow, acolumn, adata, this); }

QModelIndex createIndex | ( | int | row,
|  | int | column,
|  | int | id
| ) |  | const `[inline, protected]`

Search for all occurrences

Definition at line 321 of file qabstractitemmodel.h.

                             : 4312 ) // avoid conversion warning on 64-bit
    #endif
    { return QModelIndex(arow, acolumn, reinterpret_cast<void*>(aid), this); }

QModelIndex createIndex | ( | int | row,
|  | int | column,
|  | quint32 | id
| ) |  | const `[inline, protected]`

Search for all occurrences

Definition at line 330 of file qabstractitemmodel.h.

                             : 4312 ) // avoid conversion warning on 64-bit
    #endif
    { return QModelIndex(arow, acolumn, reinterpret_cast<void*>(aid), this); }

void encodeData | ( | const QModelIndexList & | indexes,
|  | QDataStream & | stream
| ) |  | const `[protected]`

Search for all occurrences

bool decodeData | ( | int | row,
|  | int | column,
|  | const QModelIndex & | parent,
|  | QDataStream & | stream
| ) |  | `[protected]`

Search for all occurrences

void beginInsertRows | ( | const QModelIndex & | parent,
|  | int | first,
|  | int | last
| ) |  | `[protected]`

Search for all occurrences

void endInsertRows | ( |  | ) | `[protected]`

Search for all occurrences

void beginRemoveRows | ( | const QModelIndex & | parent,
|  | int | first,
|  | int | last
| ) |  | `[protected]`

Search for all occurrences

void endRemoveRows | ( |  | ) | `[protected]`

Search for all occurrences

bool beginMoveRows | ( | const QModelIndex & | sourceParent,
|  | int | sourceFirst,
|  | int | sourceLast,
|  | const QModelIndex & | destinationParent,
|  | int | destinationRow
| ) |  | `[protected]`

Search for all occurrences

void endMoveRows | ( |  | ) | `[protected]`

Search for all occurrences

void beginInsertColumns | ( | const QModelIndex & | parent,
|  | int | first,
|  | int | last
| ) |  | `[protected]`

Search for all occurrences

void endInsertColumns | ( |  | ) | `[protected]`

Search for all occurrences

void beginRemoveColumns | ( | const QModelIndex & | parent,
|  | int | first,
|  | int | last
| ) |  | `[protected]`

Search for all occurrences

void endRemoveColumns | ( |  | ) | `[protected]`

Search for all occurrences

bool beginMoveColumns | ( | const QModelIndex & | sourceParent,
|  | int | sourceFirst,
|  | int | sourceLast,
|  | const QModelIndex & | destinationParent,
|  | int | destinationColumn
| ) |  | `[protected]`

Search for all occurrences

void endMoveColumns | ( |  | ) | `[protected]`

Search for all occurrences

void reset | ( |  | ) | `[protected]`

Search for all occurrences

void beginResetModel | ( |  | ) | `[protected]`

Search for all occurrences

void endResetModel | ( |  | ) | `[protected]`

Search for all occurrences

void changePersistentIndex | ( | const QModelIndex & | from,
|  | const QModelIndex & | to
| ) |  | `[protected]`

Search for all occurrences

void changePersistentIndexList | ( | const QModelIndexList & | from,
|  | const QModelIndexList & | to
| ) |  | `[protected]`

Search for all occurrences

QModelIndexList persistentIndexList | ( |  | ) | const `[protected]`

Search for all occurrences

void setRoleNames | ( | const QHash< int, QByteArray > & | roleNames | ) | `[protected]`

Search for all occurrences

## Friends And Related Function Documentation

friend class QPersistentModelIndexData `[friend]`

Search for all occurrences

Definition at line 163 of file qabstractitemmodel.h.

friend class QAbstractItemViewPrivate `[friend]`

Search for all occurrences

Definition at line 164 of file qabstractitemmodel.h.

The documentation for this class was generated from the following file:

- QtCore/qabstractitemmodel.h

QAbstractItemModel QAbstractItemModel QAbstractItemModel QAbstractItemModel QAbstractItemModel QAbstractItemModel QAbstractItemModel QAbstractItemModel QAbstractItemModel QAbstractItemModel
QAbstractItemModel QAbstractItemModel QAbstractItemModel QAbstractItemModel QAbstractItemModel QAbstractItemModel QAbstractItemModel QAbstractItemModel QAbstractItemModel QAbstractItemModel