Spec-Zone.ru › Qt 5.6

Класс QIdentityProxyModel

Класс QIdentityProxyModel делегирует свой исходный модель без изменений Подробнее...

Заголовок: #include <QIdentityProxyModel>
qmake: QT += core
С тех пор: Qt 4.8
Наследует: QAbstractProxyModel
  • Список всех членов, включая унаследованные

Открытые функции

QIdentityProxyModel(QObject *parent = Q_NULLPTR)
~QIdentityProxyModel()

Переопределённые открытые функции

virtual int columnCount(const QModelIndex &parent = QModelIndex()) const
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const
virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const
virtual bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex())
virtual bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex())
virtual QModelIndex mapFromSource(const QModelIndex &sourceIndex) const
virtual QItemSelection mapSelectionFromSource(const QItemSelection &selection) const
virtual QItemSelection mapSelectionToSource(const QItemSelection &selection) const
virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) 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 QModelIndex parent(const QModelIndex &child) const
virtual bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex())
virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex())
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const
virtual void setSourceModel(QAbstractItemModel *newSourceModel)
virtual QModelIndex sibling(int row, int column, const QModelIndex &idx) const
  • 28 открытых функций, унаследованных от QAbstractProxyModel
  • 39 открытых функций, унаследованных от QAbstractItemModel
  • 31 открытых функций, унаследованных от QObject

Дополнительные унаследованные члены

  • 1 свойство, унаследованное от QAbstractProxyModel
  • 1 свойство, унаследованное от QObject
  • 2 открытых слота, унаследованных от QAbstractItemModel
  • 1 открытый слот, унаследованный от QObject
  • 1 сигнал, унаследованный от QAbstractProxyModel
  • 18 сигналов, унаследованных от QAbstractItemModel
  • 2 сигнала, унаследованных от QObject
  • 11 статических открытых членов, унаследованных от QObject
  • 19 защищённых функций, унаследованных от QAbstractItemModel
  • 9 защищённых функций, унаследованных от QObject
  • 1 защищённый слот, унаследованный от QAbstractProxyModel
  • 1 защищённый слот, унаследованный от QAbstractItemModel

Подробное описание

Класс QIdentityProxyModel делегирует свой исходный модель без изменений

QIdentityProxyModel может использоваться для точного перенаправления структуры исходной модели без сортировки, фильтрации или других преобразований. Это концептуально аналогично единичной матрице, где A.I = A.

Поскольку он не выполняет сортировку или фильтрацию, этот класс наиболее подходит для делегирования моделей, которые преобразуют данные() исходной модели. Например, может быть создан делегирующий класс для определения шрифта, цвета фона, подсказки и т.д. Это позволяет избежать необходимости реализации всех обработок данных в одном классе, который создаёт структуру модели, и может также использоваться для создания многоразовых компонентов.

Это также предоставляет способ изменения данных в случае, если исходная модель предоставляется третьей стороной, которую нельзя изменить.

class DateFormatProxyModel : public QIdentityProxyModel
{
  // ...

  void setDateFormatString(const QString &formatString)
  {
    m_formatString = formatString;
  }

  QVariant data(const QModelIndex &index, int role) const
  {
    if (role != Qt::DisplayRole)
      return QIdentityProxyModel::data(index, role);

    const QDateTime dateTime = sourceModel()->data(SourceClass::DateRole).toDateTime();

    return dateTime.toString(m_formatString);
  }

private:
  QString m_formatString;
};

См. также QAbstractProxyModel, Программирование моделей/представлений и QAbstractItemModel.

Документация по функциям членов

QIdentityProxyModel::QIdentityProxyModel(QObject *parent = Q_NULLPTR)

Создаёт модель тождества с заданным parent.

QIdentityProxyModel::~QIdentityProxyModel()

Уничтожает эту модель тождества.

[virtual] int QIdentityProxyModel::columnCount(const QModelIndex &parent = QModelIndex()) const

Переопределено из QAbstractItemModel::columnCount().

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

Переопределено из QAbstractItemModel::dropMimeData().

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

Переопределено из QAbstractItemModel::headerData().

[virtual] QModelIndex QIdentityProxyModel::index(int row, int column, const QModelIndex &parent = QModelIndex()) const

Переопределено из QAbstractItemModel::index().

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

Переопределено из QAbstractItemModel::insertColumns().

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

Реализовано повторно из QAbstractItemModel::insertRows().

[virtual] QModelIndex QIdentityProxyModel::mapFromSource(const QModelIndex &sourceIndex) const

Реализовано повторно из QAbstractProxyModel::mapFromSource().

[virtual] QItemSelection QIdentityProxyModel::mapSelectionFromSource(const QItemSelection &selection) const

Реализовано повторно из QAbstractProxyModel::mapSelectionFromSource().

[virtual] QItemSelection QIdentityProxyModel::mapSelectionToSource(const QItemSelection &selection) const

Реализовано повторно из QAbstractProxyModel::mapSelectionToSource().

[virtual] QModelIndex QIdentityProxyModel::mapToSource(const QModelIndex &proxyIndex) const

Реализовано повторно из QAbstractProxyModel::mapToSource().

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

Реализовано повторно из QAbstractItemModel::match().

[virtual] QModelIndex QIdentityProxyModel::parent(const QModelIndex &child) const

Реализовано повторно из QAbstractItemModel::parent().

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

Реализовано повторно из QAbstractItemModel::removeColumns().

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

Реализовано повторно из QAbstractItemModel::removeRows().

[virtual] int QIdentityProxyModel::rowCount(const QModelIndex &parent = QModelIndex()) const

Реализовано повторно из QAbstractItemModel::rowCount().

[virtual] void QIdentityProxyModel::setSourceModel(QAbstractItemModel *newSourceModel)

Реализовано повторно из QAbstractProxyModel::setSourceModel().

[virtual] QModelIndex QIdentityProxyModel::sibling(int row, int column, const QModelIndex &idx) const

Реализовано повторно из QAbstractItemModel::sibling().

© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/archives/qt-5.6/qidentityproxymodel.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API