Qt:Документация 4.3.2/qproxymodel
Материал из Wiki.crossplatform.ru
Внимание: Актуальная версия перевода документации находится здесь |
__NOTOC__
Главная · Все классы · Основные классы · Классы по группам · Модули · Функции |
[править] QProxyModel Class Reference
[модуль QtGui ]
The QProxyModel class provides support for processing data passed between another model and a view. Далее...
#include <QProxyModel>
Данный класс устарел. Он предоставлен для поддержки ранее написанного кода. Мы настоятельно не рекомендуем использовать этот класс в новом коде.
Inherits QAbstractItemModel.
[править] Открытые функции
- QProxyModel ( QObject * parent = 0 )
- ~QProxyModel ()
- virtual int columnCount ( const QModelIndex & parent ) const
- virtual QVariant data ( const QModelIndex & index, int role ) const
- virtual bool dropMimeData ( const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent )
- virtual void fetchMore ( const QModelIndex & parent )
- virtual Qt::ItemFlags flags ( const QModelIndex & index ) const
- virtual bool hasChildren ( const QModelIndex & parent ) const
- virtual QVariant headerData ( int section, Qt::Orientation orientation, int role ) const
- virtual QModelIndex index ( int row, int column, const QModelIndex & parent ) const
- virtual bool insertColumns ( int column, int count, const QModelIndex & parent )
- virtual bool insertRows ( int row, int count, const QModelIndex & parent )
- virtual QModelIndexList match ( const QModelIndex & start, int role, const QVariant & value, int hits, Qt::MatchFlags flags ) const
- virtual QMimeData * mimeData ( const QModelIndexList & indexes ) const
- virtual QStringList mimeTypes () const
- QAbstractItemModel * model () const
- virtual QModelIndex parent ( const QModelIndex & child ) const
- virtual void revert ()
- virtual int rowCount ( const QModelIndex & parent ) const
- virtual bool setData ( const QModelIndex & index, const QVariant & value, int role )
- virtual bool setHeaderData ( int section, Qt::Orientation orientation, const QVariant & value, int role )
- virtual void setModel ( QAbstractItemModel * model )
- virtual void sort ( int column, Qt::SortOrder order )
- virtual QSize span ( const QModelIndex & index ) const
- virtual bool submit ()
- virtual Qt::DropActions supportedDropActions () const
- 34 открытых функций, унаследованных от QAbstractItemModel
- 29 открытых функций, унаследованных от QObject
[править] Дополнительные унаследованные члены
- 1 свойство, унаследованное от QObject
- 2 открытых слотов, унаследованных от QAbstractItemModel
- 1 открытый слот, унаследованный от QObject
- 14 сигналов, унаследованных от QAbstractItemModel
- 1 сигнал, унаследованный от QObject
- 5 статических открытых членов, унаследованных от QObject
- 14 защищенных функций, унаследованных от QAbstractItemModel
- 7 защищенных функций, унаследованных от QObject
[править] Подробное описание
The QProxyModel class provides support for processing data passed between another model and a view.
If you want to do filtering and sorting, see QSortFilterProxyModel.
Proxy models provide a standard model interface that can be used to manipulate the data retrieved through an underlying model. They can be used to perform operations such as sorting and filtering on the data obtained without changing the contents of the model.
Just as with subclasses of QAbstractItemView, QProxyModel provides the setModel() function that is used to specify the model to be acted on by the proxy. Views can be connected to either the underlying model or the proxy model with QAbstractItemView::setModel().
Since views rely on the information provided in model indexes to identify items of data from models, and to position these items in some visual representation, proxy models must create their own model indexes instead of supplying model indexes from their underlying models.
See also Model/View Programming and QAbstractItemModel.
[править] Описание функций-членов
[править] QProxyModel::QProxyModel ( QObject * parent = 0 )
Constructs a proxy model with the given parent.
[править] QProxyModel::~QProxyModel ()
Destroys the proxy model.
[править] int QProxyModel::columnCount ( const QModelIndex & parent ) const [virtual]
Returns the number of columns for the given parent.
Переопределено из QAbstractItemModel.
See also QAbstractItemModel::columnCount().
[править] QVariant QProxyModel::data ( const QModelIndex & index, int role ) const [virtual]
Returns the data stored in the item with the given index under the specified role.
Переопределено из QAbstractItemModel.
Смотрите также setData().
[править] bool QProxyModel::dropMimeData ( const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent ) [virtual]
Returns true if the model accepts the data dropped onto an attached view for the specified action; otherwise returns false.
The parent, row, and column details can be used to control which MIME types are acceptable to different parts of a model when received via the drag and drop system.
Переопределено из QAbstractItemModel.
[править] void QProxyModel::fetchMore ( const QModelIndex & parent ) [virtual]
Fetches more child items of the given parent. This function is used by views to tell the model that they can display more data than the model has provided.
Переопределено из QAbstractItemModel.
See also QAbstractItemModel::fetchMore().
[править] Qt::ItemFlags QProxyModel::flags ( const QModelIndex & index ) const [virtual]
Returns the item flags for the given index.
Переопределено из QAbstractItemModel.
[править] bool QProxyModel::hasChildren ( const QModelIndex & parent ) const [virtual]
Returns true if the item corresponding to the parent index has child items; otherwise returns false.
Переопределено из QAbstractItemModel.
See also QAbstractItemModel::hasChildren().
[править] QVariant QProxyModel::headerData ( int section, Qt::Orientation orientation, int role ) const [virtual]
Returns the data stored in the section of the header with specified orientation under the given role.
Переопределено из QAbstractItemModel.
See also setHeaderData().
[править] QModelIndex QProxyModel::index ( int row, int column, const QModelIndex & parent ) const [virtual]
Returns the model index with the given row, column, and parent.
Переопределено из QAbstractItemModel.
See also QAbstractItemModel::index().
[править] bool QProxyModel::insertColumns ( int column, int count, const QModelIndex & parent ) [virtual]
Inserts count columns into the model, creating new items as children of the given parent. The new columns are inserted before the column specified. If the 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.
Переопределено из QAbstractItemModel.
See also QAbstractItemModel::insertColumns().
[править] bool QProxyModel::insertRows ( int row, int count, const QModelIndex & parent ) [virtual]
Inserts count rows into the model, creating new items as children of the given parent. The new rows are inserted before the row specified. If the 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.
Переопределено из QAbstractItemModel.
See also QAbstractItemModel::insertRows().
[править] QModelIndexList QProxyModel::match ( const QModelIndex & start, int role, const QVariant & value, int hits, Qt::MatchFlags flags ) const [virtual]
Returns a list of model indexes that each contain the given value for the role specified. The search begins at the start index and is performed according to the specified flags. The search continues until the number of matching data items equals hits, the last row is reached, or the search reaches start again, depending on whether MatchWrap is specified in flags.
Переопределено из QAbstractItemModel.
See also QAbstractItemModel::match().
[править] QMimeData * QProxyModel::mimeData ( const QModelIndexList & indexes ) const [virtual]
Returns MIME data for the specified indexes in the model.
Переопределено из QAbstractItemModel.
[править] QStringList QProxyModel::mimeTypes () const [virtual]
Returns a list of MIME types that are supported by the model.
Переопределено из QAbstractItemModel.
[править] QAbstractItemModel * QProxyModel::model () const
Returns the model that contains the data that is available through the proxy model.
See also setModel().
[править] QModelIndex QProxyModel::parent ( const QModelIndex & child ) const [virtual]
Returns the model index that corresponds to the parent of the given child index.
Переопределено из QAbstractItemModel.
[править] void QProxyModel::revert () [virtual]
Переопределено из QAbstractItemModel.
[править] int QProxyModel::rowCount ( const QModelIndex & parent ) const [virtual]
Returns the number of rows for the given parent.
Переопределено из QAbstractItemModel.
See also QAbstractItemModel::rowCount().
[править] bool QProxyModel::setData ( const QModelIndex & index, const QVariant & value, int role ) [virtual]
Sets the role data for the item at index to value. Возвращает true в случае успеха; при неудаче возвращается false.
The base class implementation returns false. This function and data() must be reimplemented for editable models.
Переопределено из QAbstractItemModel.
See also data(), itemData(), and QAbstractItemModel::setData().
[править] bool QProxyModel::setHeaderData ( int section, Qt::Orientation orientation, const QVariant & value, int role ) [virtual]
Sets the role data in the section of the header with the specified orientation to the value given.
Переопределено из QAbstractItemModel.
See also headerData() and QAbstractItemModel::setHeaderData().
[править] void QProxyModel::setModel ( QAbstractItemModel * model ) [virtual]
Sets the given model to be processed by the proxy model.
See also model().
[править] void QProxyModel::sort ( int column, Qt::SortOrder order ) [virtual]
Sorts the child items in the specified column according to the sort order defined by order.
Переопределено из QAbstractItemModel.
See also QAbstractItemModel::sort().
[править] QSize QProxyModel::span ( const QModelIndex & index ) const [virtual]
Returns the size of the item that corresponds to the specified index.
Переопределено из QAbstractItemModel.
[править] bool QProxyModel::submit () [virtual]
Переопределено из QAbstractItemModel.
[править] Qt::DropActions QProxyModel::supportedDropActions () const [virtual]
Returns the drop actions that are supported by the model; this is a combination of the individual actions defined in Qt::DropActions.
The selection of drop actions provided by the model will influence the behavior of the component that started the drag and drop operation.
Переопределено из QAbstractItemModel.
See also Drag and Drop.
Copyright © 2007 Trolltech | Trademarks | Qt 4.3.2
|