⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qproxymodel.cpp

📁 奇趣公司比较新的qt/emd版本
💻 CPP
📖 第 1 页 / 共 2 页
字号:
    The selection of drop actions provided by the model will influence the    behavior of the component that started the drag and drop operation.    \sa \link dnd.html Drag and Drop\endlink*/Qt::DropActions QProxyModel::supportedDropActions() const{    Q_D(const QProxyModel);    return d->model->supportedDropActions();}/*!    Inserts \a count rows into the model, creating new items as children of    the given \a parent. The new rows are inserted before the \a row    specified. If the \a parent item has no children, a single column is    created to contain the required number of rows.    Returns true if the rows were successfully inserted; otherwise    returns false.    \sa QAbstractItemModel::insertRows()*/bool QProxyModel::insertRows(int row, int count, const QModelIndex &parent){    Q_D(const QProxyModel);    return d->model->insertRows(row, count, setSourceModel(parent));}/*!    Inserts \a count columns into the model, creating new items as children of    the given \a parent. The new columns are inserted before the \a column    specified. If the \a parent item has no children, a single row is created    to contain the required number of columns.    Returns true if the columns were successfully inserted; otherwise    returns false.    \sa QAbstractItemModel::insertColumns()*/bool QProxyModel::insertColumns(int column, int count, const QModelIndex &parent){    Q_D(const QProxyModel);    return d->model->insertColumns(column, count, setSourceModel(parent));}/*!    Fetches more child items of the given \a parent. This function is used by views    to tell the model that they can display more data than the model has provided.    \sa QAbstractItemModel::fetchMore()*/void QProxyModel::fetchMore(const QModelIndex &parent){    Q_D(const QProxyModel);    d->model->fetchMore(parent);}/*!    Returns the item flags for the given \a index.*/Qt::ItemFlags QProxyModel::flags(const QModelIndex &index) const{    Q_D(const QProxyModel);    return d->model->flags(setSourceModel(index));}/*!    Sorts the child items in the specified \a column according to the sort    order defined by \a order.    \sa QAbstractItemModel::sort()*/void QProxyModel::sort(int column, Qt::SortOrder order){    Q_D(QProxyModel);    d->model->sort(column, order);}/*!    Returns a list of model indexes that each contain the given \a value for    the \a role specified. The search begins at the \a start index and is    performed according to the specified \a flags. The search continues until    the number of matching data items equals \a hits, the last row is reached,    or the search reaches \a start again, depending on whether \c MatchWrap is    specified in \a flags.    \sa QAbstractItemModel::match()*/QModelIndexList QProxyModel::match(const QModelIndex &start,                                   int role, const QVariant &value,                                   int hits, Qt::MatchFlags flags) const{    Q_D(const QProxyModel);    return d->model->match(start, role, value, hits, flags);}/*!    Returns the size of the item that corresponds to the specified \a index.*/QSize QProxyModel::span(const QModelIndex &index) const{    Q_D(const QProxyModel);    return d->model->span(setSourceModel(index));}/*! */bool QProxyModel::submit(){    Q_D(QProxyModel);    return d->model->submit();}/*! */void QProxyModel::revert(){    Q_D(QProxyModel);    d->model->revert();}/*!    \internal    Change the model pointer in the given \a source_index to point to the proxy model. */QModelIndex QProxyModel::setProxyModel(const QModelIndex &source_index) const{    QModelIndex proxy_index = source_index;    if (proxy_index.isValid())        proxy_index.m = this;    return proxy_index;}/*!    \internal    Change the model pointer in the given \a proxy_index to point to the source model. */QModelIndex QProxyModel::setSourceModel(const QModelIndex &proxy_index) const{    Q_D(const QProxyModel);    QModelIndex source_index = proxy_index;    source_index.m = d->model;    return source_index;}/*!  \internal  Connect to all the signals emitted by given \a model.*/void QProxyModel::connectToModel(const QAbstractItemModel *model) const{    connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),            this, SLOT(_q_sourceDataChanged(QModelIndex,QModelIndex)));    connect(model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)),            this, SIGNAL(headerDataChanged(Qt::Orientation,int,int))); // signal to signal    connect(model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)),            this, SLOT(_q_sourceRowsAboutToBeInserted(QModelIndex,int,int)));    connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)),            this, SLOT(_q_sourceRowsInserted(QModelIndex,int,int)));    connect(model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),            this, SLOT(_q_sourceRowsAboutToBeRemoved(QModelIndex,int,int)));    connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)),            this, SLOT(_q_sourceRowsRemoved(QModelIndex,int,int)));    connect(model, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)),            this, SLOT(_q_sourceColumnsAboutToBeInserted(QModelIndex,int,int)));    connect(model, SIGNAL(columnsInserted(QModelIndex,int,int)),            this, SLOT(_q_sourceColumnsInserted(QModelIndex,int,int)));    connect(model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)),            this, SLOT(_q_sourceColumnsAboutToBeRemoved(QModelIndex,int,int)));    connect(model, SIGNAL(columnsRemoved(QModelIndex,int,int)),            this, SLOT(_q_sourceColumnsRemoved(QModelIndex,int,int)));    connect(model, SIGNAL(modelReset()), this, SIGNAL(modelReset())); // signal to signal    connect(model, SIGNAL(layoutAboutToBeChanged()), this, SIGNAL(layoutAboutToBeChanged())); // signal to signal    connect(model, SIGNAL(layoutChanged()), this, SIGNAL(layoutChanged())); // signal to signal}/*!  \internal  Disconnect from all the signals emitted by the given \a model. */void QProxyModel::disconnectFromModel(const QAbstractItemModel *model) const{    disconnect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),               this, SLOT(_q_sourceDataChanged(QModelIndex,QModelIndex)));    disconnect(model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)),               this, SIGNAL(headerDataChanged(Qt::Orientation,int,int))); // signal to signal    disconnect(model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)),               this, SLOT(_q_sourceRowsAboutToBeInserted(QModelIndex,int,int)));    disconnect(model, SIGNAL(rowsInserted(QModelIndex,int,int)),               this, SLOT(rowsInserted(QModelIndex,int,int)));    disconnect(model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),               this, SLOT(_q_sourceRowsAboutToBeRemoved(QModelIndex,int,int)));    disconnect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)),               this, SLOT(_q_sourceRowsRemoved(QModelIndex,int,int)));    disconnect(model, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)),               this, SLOT(_q_sourceColumnsAboutToBeInserted(QModelIndex,int,int)));    disconnect(model, SIGNAL(columnsInserted(QModelIndex,int,int)),               this, SLOT(_q_sourceColumnsInserted(QModelIndex,int,int)));    disconnect(model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)),               this, SLOT(_q_sourceColumnsAboutToBeRemoved(QModelIndex,int,int)));    disconnect(model, SIGNAL(columnsRemoved(QModelIndex,int,int)),               this, SLOT(_q_sourceColumnsRemoved(QModelIndex,int,int)));    disconnect(model, SIGNAL(modelReset()), this, SIGNAL(modelReset())); // signal to signal    disconnect(model, SIGNAL(layoutAboutToBeChanged()), this, SIGNAL(layoutAboutToBeChanged())); // signal to signal    disconnect(model, SIGNAL(layoutChanged()), this, SIGNAL(layoutChanged())); // signal to signal}/*!  \fn QObject *QProxyModel::parent() const  \internal*/void QProxyModelPrivate::_q_sourceDataChanged(const QModelIndex &tl,const QModelIndex &br){    Q_Q(QProxyModel);    emit q->dataChanged(q->setProxyModel(tl), q->setProxyModel(br));}void QProxyModelPrivate::_q_sourceRowsAboutToBeInserted(const QModelIndex &parent, int first ,int last){    Q_Q(QProxyModel);    q->beginInsertRows(q->setProxyModel(parent), first, last);}void QProxyModelPrivate::_q_sourceRowsInserted(const QModelIndex &, int, int){    Q_Q(QProxyModel);    q->endInsertRows();}void QProxyModelPrivate::_q_sourceRowsAboutToBeRemoved(const QModelIndex &parent, int first, int last){    Q_Q(QProxyModel);    q->beginRemoveRows(q->setProxyModel(parent), first, last);}void QProxyModelPrivate::_q_sourceRowsRemoved(const QModelIndex &, int, int){    Q_Q(QProxyModel);    q->endRemoveRows();}void QProxyModelPrivate::_q_sourceColumnsAboutToBeInserted(const QModelIndex &parent, int first, int last){    Q_Q(QProxyModel);    q->beginInsertColumns(q->setProxyModel(parent), first, last);}void QProxyModelPrivate::_q_sourceColumnsInserted(const QModelIndex &, int, int){    Q_Q(QProxyModel);    q->endInsertColumns();}void QProxyModelPrivate::_q_sourceColumnsAboutToBeRemoved(const QModelIndex &parent, int first, int last){    Q_Q(QProxyModel);    q->beginRemoveColumns(q->setProxyModel(parent), first, last);}void QProxyModelPrivate::_q_sourceColumnsRemoved(const QModelIndex &, int, int){    Q_Q(QProxyModel);    q->endRemoveColumns();}#include "moc_qproxymodel.cpp"#endif // QT_NO_PROXYMODEL

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -