44 #ifndef QT_NO_PROXYMODEL 45 #include <private/qproxymodel_p.h> 117 if (
d->model &&
d->model != &
d->empty)
123 d->model = &
d->empty;
224 return d->model->headerData(section, orientation, role);
237 return d->model->setHeaderData(section, orientation, value, role);
246 return d->model->mimeTypes();
256 for (
int i = 0; i < indexes.
count(); ++i)
258 return d->model->mimeData(lst);
273 return d->model->dropMimeData(data, action, row, column,
setSourceModel(parent));
288 return d->model->supportedDropActions();
333 d->model->fetchMore(parent);
354 d->model->sort(column, order);
369 int hits, Qt::MatchFlags
flags)
const 372 return d->model->match(start, role, value, hits, flags);
389 return d->model->submit();
411 proxy_index.
m =
this;
426 source_index.
m =
d->model;
506 emit q->dataChanged(q->setProxyModel(tl), q->setProxyModel(br));
512 q->beginInsertRows(q->setProxyModel(parent), first, last);
524 q->beginRemoveRows(q->setProxyModel(parent), first, last);
536 q->beginInsertColumns(q->setProxyModel(parent), first, last);
542 q->endInsertColumns();
548 q->beginRemoveColumns(q->setProxyModel(parent), first, last);
555 q->endRemoveColumns();
560 #include "moc_qproxymodel.cpp" 562 #endif // QT_NO_PROXYMODEL The QVariant class acts like a union for the most common Qt data types.
void _q_sourceColumnsAboutToBeRemoved(const QModelIndex &parent, int first, int last)
#define QT_END_NAMESPACE
This macro expands to.
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
Returns the data stored in the item with the given index under the specified role.
virtual void setModel(QAbstractItemModel *model)
Sets the given model to be processed by the proxy model.
bool insertColumns(int column, int count, const QModelIndex &parent=QModelIndex())
Inserts count columns into the model, creating new items as children of the given parent...
void columnsInserted(const QModelIndex &parent, int first, int last)
This signal is emitted after columns have been inserted into the model.
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Returns the model index with the given row, column, and parent.
int count(const T &t) const
Returns the number of occurrences of value in the list.
void _q_sourceRowsRemoved(const QModelIndex &parent, int first, int last)
The QObject class is the base class of all Qt objects.
void _q_sourceColumnsAboutToBeInserted(const QModelIndex &parent, int first, int last)
QModelIndex setSourceModel(const QModelIndex &proxy_index) const
Change the model pointer in the given proxy_index to point to the source model.
void _q_sourceColumnsInserted(const QModelIndex &parent, int first, int last)
bool submit()
Lets the model know that it should submit cached information to permanent storage.
int columnCount(const QModelIndex &parent=QModelIndex()) const
Returns the number of columns for the given parent.
void columnsAboutToBeInserted(const QModelIndex &parent, int first, int last)
This signal is emitted just before columns are inserted into the model.
void append(const T &t)
Inserts value at the end of the list.
void sort(int column, Qt::SortOrder order=Qt::AscendingOrder)
Sorts the child items in the specified column according to the sort order defined by order...
#define QT_BEGIN_NAMESPACE
This macro expands to.
void _q_sourceRowsAboutToBeRemoved(const QModelIndex &parent, int first, int last)
void layoutAboutToBeChanged()
This signal is emitted just before the layout of a model is changed.
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
The QProxyModel class provides support for processing data passed between another model and a view...
void rowsAboutToBeInserted(const QModelIndex &parent, int first, int last)
This signal is emitted just before rows are inserted into the model.
void fetchMore(const QModelIndex &parent)
Fetches more child items of the given parent.
const T & at(int i) const
Returns the item at index position i in the list.
The QStringList class provides a list of strings.
void _q_sourceColumnsRemoved(const QModelIndex &parent, int first, int last)
bool hasChildren(const QModelIndex &parent=QModelIndex()) const
Returns true if the item corresponding to the parent index has child items; otherwise returns false...
Qt::ItemFlags flags(const QModelIndex &index) const
Returns the item flags for the given index.
QModelIndex setProxyModel(const QModelIndex &source_index) const
Change the model pointer in the given source_index to point to the proxy model.
const QAbstractItemModel * m
void layoutChanged()
This signal is emitted whenever the layout of items exposed by the model has changed; for example...
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.
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
Sets the role data for the item at index to value.
The QAbstractItemModel class provides the abstract interface for item model classes.
void columnsAboutToBeRemoved(const QModelIndex &parent, int first, int last)
This signal is emitted just before columns are removed from the model.
bool insertRows(int row, int count, const QModelIndex &parent=QModelIndex())
Inserts count rows into the model, creating new items as children of the given parent.
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
Disconnects signal in object sender from method in object receiver.
void revert()
Lets the model know that it should discard cached information.
void _q_sourceRowsAboutToBeInserted(const QModelIndex &parent, int first, int last)
QStringList mimeTypes() const
Returns a list of MIME types that are supported by the model.
void _q_sourceRowsInserted(const QModelIndex &parent, int first, int last)
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
Returns true if the model accepts the data dropped onto an attached view for the specified action; ot...
QAbstractItemModel * model() const
Returns the model that contains the data that is available through the proxy model.
void headerDataChanged(Qt::Orientation orientation, int first, int last)
This signal is emitted whenever a header is changed.
QProxyModel(QObject *parent=0)
Constructs a proxy model with the given parent.
void rowsInserted(const QModelIndex &parent, int first, int last)
This signal is emitted after rows have been inserted into the model.
QModelIndexList match(const QModelIndex &start, int role, const QVariant &value, int hits=1, Qt::MatchFlags flags=Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const
Returns a list of model indexes that each contain the given value for the role specified.
QObject * parent() const
Returns a pointer to the parent object.
QMimeData * mimeData(const QModelIndexList &indexes) const
Returns MIME data for the specified indexes in the model.
void disconnectFromModel(const QAbstractItemModel *model) const
Disconnect from all the signals emitted by the given model.
The QModelIndex class is used to locate data in a data 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.
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Returns the data stored in the section of the header with specified orientation under the given role...
void _q_sourceDataChanged(const QModelIndex &tl, const QModelIndex &br)
The QSize class defines the size of a two-dimensional object using integer point precision.
bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role=Qt::EditRole)
Sets the role data in the section of the header with the specified orientation to the value given...
void rowsAboutToBeRemoved(const QModelIndex &parent, int first, int last)
This signal is emitted just before rows are removed from the model.
QSize span(const QModelIndex &index) const
Returns the size of the item that corresponds to the specified index.
void rowsRemoved(const QModelIndex &parent, int first, int last)
This signal is emitted after rows have been removed from the model.
~QProxyModel()
Destroys the proxy model.
int rowCount(const QModelIndex &parent=QModelIndex()) const
Returns the number of rows for the given parent.
void connectToModel(const QAbstractItemModel *model) const
Connect to all the signals emitted by given model.
void columnsRemoved(const QModelIndex &parent, int first, int last)
This signal is emitted after columns have been removed from the model.
Qt::DropActions supportedDropActions() const
Returns the drop actions that are supported by the model; this is a combination of the individual act...