42 #ifndef QABSTRACTITEMMODEL_H 43 #define QABSTRACTITEMMODEL_H 45 #include <QtCore/qvariant.h> 46 #include <QtCore/qobject.h> 47 #include <QtCore/qhash.h> 65 : r(other.r),
c(other.
c), p(other.p), m(other.m) {}
67 inline int row()
const {
return r; }
73 inline QModelIndex child(
int row,
int column)
const;
75 inline Qt::ItemFlags
flags()
const;
77 inline bool isValid()
const {
return (r >= 0) && (
c >= 0) && (m != 0); }
79 {
return (other.
r == r) && (other.
p == p) && (other.
c ==
c) && (other.
m == m); }
81 {
return !(*
this == other); }
84 if (r < other.
r)
return true;
86 if (
c < other.
c)
return true;
88 if (p < other.
p)
return true;
89 if (p == other.
p)
return m < other.
m;
101 #ifndef QT_NO_DEBUG_STREAM 125 void *internalPointer()
const;
126 qint64 internalId()
const;
131 Qt::ItemFlags flags()
const;
133 bool isValid()
const;
137 #ifndef QT_NO_DEBUG_STREAM 144 {
return qHash(index.
d); }
147 #ifndef QT_NO_DEBUG_STREAM 156 template <
class Key,
class T>
class QMap;
219 const QVariant &value,
int hits = 1,
220 Qt::MatchFlags flags =
226 #ifdef Q_NO_USING_KEYWORD 238 #if !defined(Q_MOC_RUN) && !defined(qdoc) 324 {
return QModelIndex(arow, acolumn, adata,
this); }
326 #if defined(Q_CC_MSVC) 327 #pragma warning( push ) 328 #pragma warning( disable : 4312 ) // avoid conversion warning on 64-bit 330 {
return QModelIndex(arow, acolumn, reinterpret_cast<void*>(aid),
this); }
331 #if defined(Q_CC_MSVC) 332 #pragma warning( pop ) 335 #if defined(Q_CC_MSVC) 336 #pragma warning( push ) 337 #pragma warning( disable : 4312 ) // avoid conversion warning on 64-bit 339 {
return QModelIndex(arow, acolumn, reinterpret_cast<void*>(aid),
this); }
340 #if defined(Q_CC_MSVC) 341 #pragma warning( pop ) 390 : r(arow),
c(acolumn), p(adata), m(amodel) {}
405 {
return m ?
m->
flags(*
this) : Qt::ItemFlags(0); }
414 #endif // QABSTRACTITEMMODEL_H The QVariant class acts like a union for the most common Qt data types.
The QDebug class provides an output stream for debugging information.
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const =0
Returns the number of columns for the children of the given parent.
void * internalPointer() const
Returns a void * pointer used by the model to associate the index with the internal data structure...
QModelIndex sibling(int row, int column, const QModelIndex &idx) const
Returns the sibling at row and column for the item at index, or an invalid QModelIndex if there is no...
bool removeRow(int row, const QModelIndex &parent=QModelIndex())
Removes the given row from the child items of the parent specified.
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
Handles the data supplied by a drag and drop operation that ended with the given action.
QModelIndexList persistentIndexList() const
Returns the list of indexes stored as persistent indexes in the model.
#define QT_END_NAMESPACE
This macro expands to.
void beginInsertColumns(const QModelIndex &parent, int first, int last)
Begins a column insertion operation.
QVariant data(int role=Qt::DisplayRole) const
Returns the data for the given role for the item referred to by the index.
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex())
Reimplemented Function
QModelIndex sibling(int row, int column) const
Returns the sibling at row and column.
Q_CORE_EXPORT QDebug operator<<(QDebug, const QModelIndex &)
QVariant headerData(int section, Qt::Orientation orientation, int role) const
Reimplemented Function
Q_CORE_EXPORT QTextStream & reset(QTextStream &s)
bool removeColumns(int column, int count, const QModelIndex &parent=QModelIndex())
Reimplemented Function
void beginRemoveColumns(const QModelIndex &parent, int first, int last)
Begins a column removal operation.
static bool match(const uchar *found, const char *target, uint len)
void columnsInserted(const QModelIndex &parent, int first, int last)
This signal is emitted after columns have been inserted into the model.
QModelIndex createIndex(int row, int column, void *data=0) const
Creates a model index for the given row and column with the internal pointer ptr. ...
bool insertRows(int row, int count, const QModelIndex &parent=QModelIndex())
Reimplemented Function
#define Q_DISABLE_COPY(Class)
Disables the use of copy constructors and assignment operators for the given Class.
void fetchMore(const QModelIndex &parent)
Reimplemented Function
bool operator!=(const QModelIndex &other) const
Returns true if this model index does not refer to the same location as the other model index; otherw...
bool canFetchMore(const QModelIndex &parent) const
Reimplemented Function
bool hasIndex(int row, int column, const QModelIndex &parent=QModelIndex()) const
Returns true if the model returns a valid QModelIndex for row and column with parent, otherwise returns false.
The QAbstractListModel class provides an abstract model that can be subclassed to create one-dimensio...
bool operator!=(QBool b1, bool b2)
void endInsertRows()
Ends a row insertion operation.
bool insertColumns(int column, int count, const QModelIndex &parent=QModelIndex())
Reimplemented Function
void columnsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationColumn)
This signal is emitted just before columns are moved within the model.
The QObject class is the base class of all Qt objects.
void rowsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow)
This signal is emitted just before rows are moved within the model.
void endMoveRows()
Ends a row move operation.
bool operator<(int priority, const QPair< QRunnable *, int > &p)
bool decodeData(int row, int column, const QModelIndex &parent, QDataStream &stream)
void endResetModel()
Completes a model reset operation.
QModelIndex parent() const
Returns the parent of the model index, or QModelIndex() if it has no parent.
bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role=Qt::EditRole)
Reimplemented Function
void changePersistentIndexList(const QModelIndexList &from, const QModelIndexList &to)
Changes the QPersistentModelIndexes that is equal to the indexes in the given from model index list t...
virtual Qt::ItemFlags flags(const QModelIndex &index) const
Returns the item flags for the given index.
virtual QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const =0
Returns the index of the item in the model specified by the given row, column and parent index...
void columnsAboutToBeInserted(const QModelIndex &parent, int first, int last)
This signal is emitted just before columns are inserted into the model.
bool beginMoveColumns(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationColumn)
Begins a column move operation.
#define QT_BEGIN_NAMESPACE
This macro expands to.
~QModelIndex()
Destroys the model index.
void rowsMoved(const QModelIndex &parent, int start, int end, const QModelIndex &destination, int row)
This signal is emitted after rows have been moved within the model.
qint64 internalId() const
Returns a qint64 used by the model to associate the index with the internal data structure.
void layoutAboutToBeChanged()
This signal is emitted just before the layout of a model is changed.
static void sort(T *array, int count, LessThan lessThan)
virtual bool hasChildren(const QModelIndex &parent=QModelIndex()) const
Returns true if parent has any children; otherwise returns false.
void resetInternalData()
This slot is called just after the internal data of a model is cleared while it is being reset...
The QProxyModel class provides support for processing data passed between another model and a view...
bool insertRow(int row, const QModelIndex &parent=QModelIndex())
Inserts a single row before the given row in the child items of the parent specified.
void revert()
Reimplemented Function
void rowsAboutToBeInserted(const QModelIndex &parent, int first, int last)
This signal is emitted just before rows are inserted into the model.
static bool setData(const QByteArray &data, STGMEDIUM *pmedium)
int row() const
Returns the row this model index refers to.
QModelIndex()
Creates a new empty model index.
Qt::DropActions supportedDropActions() const
Reimplemented Function
QModelIndex(const QModelIndex &other)
Creates a new model index that is a copy of the other model index.
Qt::DropActions supportedDragActions() const
Returns the actions supported by the data in this model.
const QAbstractItemModel * model() const
Returns a pointer to the model containing the item that this index refers to.
The QStringList class provides a list of strings.
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
Reimplemented Function
void modelAboutToBeReset()
This signal is emitted when reset() is called, before the model's internal state (e.
Qt::ItemFlags flags(const QModelIndex &index) const
Returns the item flags for the given index.
QMap< int, QVariant > itemData(const QModelIndex &index) const
Reimplemented Function
QStringList mimeTypes() const
Reimplemented Function
static const char * data(const QByteArray &arr)
void encodeData(const QModelIndexList &indexes, QDataStream &stream) const
bool operator==(const QModelIndex &other) const
Returns true if this model index refers to the same location as the other model index; otherwise retu...
const QAbstractItemModel * m
QPersistentModelIndexData * d
virtual QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const =0
Returns the data stored under the given role for the item referred to by the index.
const T * ptr(const T &t)
bool hasChildren(const QModelIndex &parent=QModelIndex()) const
Reimplemented Function
void endRemoveRows()
Ends a row removal operation.
QModelIndex buddy(const QModelIndex &index) const
Reimplemented Function
void layoutChanged()
This signal is emitted whenever the layout of items exposed by the model has changed; for example...
QSize span(const QModelIndex &index) const
Reimplemented Function
The QMimeData class provides a container for data that records information about its MIME type...
bool isValid() const
Returns true if this model index is valid; otherwise returns false.
uint qHash(const QPersistentModelIndex &index)
The QAbstractItemModel class provides the abstract interface for item model classes.
Qt::ItemFlags flags() const
Returns the flags for the item referred to by the index.
bool removeColumn(int column, const QModelIndex &parent=QModelIndex())
Removes the given column from the child items of the parent specified.
virtual QModelIndex parent(const QModelIndex &child) const =0
Returns the parent of the model item with the given index.
void columnsAboutToBeRemoved(const QModelIndex &parent, int first, int last)
This signal is emitted just before columns are removed from the model.
QList< QModelIndex > QModelIndexList
QModelIndex child(int row, int column) const
Returns the child of the model index that is stored in the given row and column.
bool insertColumn(int column, const QModelIndex &parent=QModelIndex())
Inserts a single column before the given column in the child items of the parent specified.
const QHash< int, QByteArray > & roleNames() const
Returns the model's role names.
QAbstractItemModel * model() const
Returns the model that contains the data that is available through the proxy model.
void changePersistentIndex(const QModelIndex &from, const QModelIndex &to)
Changes the QPersistentModelIndex that is equal to the given from model index to the given to model i...
bool setItemData(const QModelIndex &index, const QMap< int, QVariant > &roles)
Reimplemented Function
void headerDataChanged(Qt::Orientation orientation, int first, int last)
This signal is emitted whenever a header is changed.
The QPersistentModelIndex class is used to locate data in a data model.
void rowsInserted(const QModelIndex &parent, int first, int last)
This signal is emitted after rows have been inserted into the model.
QMimeData * mimeData(const QModelIndexList &indexes) const
Reimplemented Function
int rowCount(const QModelIndex &parent=QModelIndex()) const
Reimplemented Function
bool operator!=(const QPersistentModelIndex &other) const
Returns true if this persistent model index is not equal to the other persistent model index; otherwi...
QObject * parent() const
Returns a pointer to the parent object.
void beginRemoveRows(const QModelIndex &parent, int first, int last)
Begins a row removal operation.
The QModelIndex class is used to locate data in a data model.
virtual ~QAbstractItemModel()
Destroys the abstract item model.
void modelReset()
This signal is emitted when reset() is called, after the model's internal state (e.
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
This signal is emitted whenever the data in an existing item changes.
void setSupportedDragActions(Qt::DropActions)
Sets the supported drag actions for the items in the model.
The QIdentityProxyModel class proxies its source model unmodified.
void endInsertColumns()
Ends a column insertion operation.
Qt::ItemFlags flags(const QModelIndex &index) const
Reimplemented Function
QAbstractItemModel(QObject *parent=0)
Constructs an abstract item model with the given parent.
The QSize class defines the size of a two-dimensional object using integer point precision.
#define Q_DECLARE_PRIVATE(Class)
The QDataStream class provides serialization of binary data to a QIODevice.
void setRoleNames(const QHash< int, QByteArray > &roleNames)
Sets the model's role names to roleNames.
void endMoveColumns()
Ends a column move operation.
bool submit()
Reimplemented Function
static const KeyPair *const end
void rowsAboutToBeRemoved(const QModelIndex &parent, int first, int last)
This signal is emitted just before rows are removed from the model.
int columnCount(const QModelIndex &parent=QModelIndex()) const
Reimplemented Function
void rowsRemoved(const QModelIndex &parent, int first, int last)
This signal is emitted after rows have been removed from the model.
void columnsMoved(const QModelIndex &parent, int start, int end, const QModelIndex &destination, int column)
This signal is emitted after columns have been moved within the model.
bool operator==(QBool b1, bool b2)
bool beginMoveRows(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationRow)
Begins a row move operation.
void columnsRemoved(const QModelIndex &parent, int first, int last)
This signal is emitted after columns have been removed from the model.
void beginResetModel()
Begins a model reset operation.
The QAbstractTableModel class provides an abstract model that can be subclassed to create table model...
The QMap class is a template class that provides a skip-list-based dictionary.
void beginInsertRows(const QModelIndex &parent, int first, int last)
Begins a row insertion operation.
int column() const
Returns the column this model index refers to.
The QList class is a template class that provides lists.
Q_DECLARE_TYPEINFO(QModelIndex, Q_MOVABLE_TYPE)
void endRemoveColumns()
Ends a column removal operation.
bool operator<(const QModelIndex &other) const
Returns true if this model index is smaller than the other model index; otherwise returns false...