com.trolltech.qt.gui
Class QAbstractProxyModel

java.lang.Object
  extended by com.trolltech.qt.internal.QSignalEmitterInternal
      extended by com.trolltech.qt.QSignalEmitter
          extended by com.trolltech.qt.QtJambiObject
              extended by com.trolltech.qt.core.QObject
                  extended by com.trolltech.qt.core.QAbstractItemModel
                      extended by com.trolltech.qt.gui.QAbstractProxyModel
All Implemented Interfaces:
QtJambiInterface
Direct Known Subclasses:
QSortFilterProxyModel

public abstract class QAbstractProxyModel
extends QAbstractItemModel

The QAbstractProxyModel class provides a base class for proxy item models that can do sorting, filtering or other data processing tasks. This class defines the standard interface that proxy models must use to be able to interoperate correctly with other model/view components. It is not supposed to be instantiated directly.

All standard proxy models are derived from the QAbstractProxyModel class. If you need to create a new proxy model class, it is usually better to subclass an existing class that provides the closest behavior to the one you want to provide.

Proxy models that filter or sort items of data from a source model should be created by using or subclassing QSortFilterProxyModel.

To subclass QAbstractProxyModel, you need to implement mapFromSource() and mapToSource(). The mapSelectionFromSource() and mapSelectionToSource() functions only need to be reimplemented if you need a behavior different from the default behavior.

Note: If the source model is deleted or no source model is specified, the proxy model operates on a empty placeholder model.

See also:
QSortFilterProxyModel, QAbstractItemModel, and Model/View Programming.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.AbstractSignal, QSignalEmitter.PrivateSignal0, QSignalEmitter.PrivateSignal1, QSignalEmitter.PrivateSignal2, QSignalEmitter.PrivateSignal3, QSignalEmitter.PrivateSignal4, QSignalEmitter.PrivateSignal5, QSignalEmitter.PrivateSignal6, QSignalEmitter.PrivateSignal7, QSignalEmitter.PrivateSignal8, QSignalEmitter.PrivateSignal9, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9
 
Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal
 
Field Summary
 
Fields inherited from class com.trolltech.qt.core.QAbstractItemModel
columnsAboutToBeInserted, columnsAboutToBeRemoved, columnsInserted, columnsRemoved, dataChanged, headerDataChanged, layoutAboutToBeChanged, layoutChanged, modelAboutToBeReset, modelReset, rowsAboutToBeInserted, rowsAboutToBeRemoved, rowsInserted, rowsRemoved
 
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
currentSender
 
Constructor Summary
QAbstractProxyModel()
          Constructs a proxy model with the given parent.
QAbstractProxyModel(QObject parent)
          Constructs a proxy model with the given parent.
 
Method Summary
abstract  com.trolltech.qt.core.QModelIndex mapFromSource(com.trolltech.qt.core.QModelIndex sourceIndex)
          Reimplement this function to return the model index in the proxy model that corresponds to the sourceIndex from the source model.
 QItemSelection mapSelectionFromSource(QItemSelection selection)
          Returns a proxy selection mapped from the specified sourceSelection.
 QItemSelection mapSelectionToSource(QItemSelection selection)
          Returns a source selection mapped from the specified proxySelection.
abstract  com.trolltech.qt.core.QModelIndex mapToSource(com.trolltech.qt.core.QModelIndex proxyIndex)
          Reimplement this function to return the model index in the source model that corresponds to the proxyIndex in the proxy model.
 void setSourceModel(QAbstractItemModel sourceModel)
          Sets the given sourceModel to be processed by the proxy model.
 QAbstractItemModel sourceModel()
          Returns the model that contains the data that is available through the proxy model.
 
Methods inherited from class com.trolltech.qt.core.QAbstractItemModel
beginInsertColumns, beginInsertRows, beginRemoveColumns, beginRemoveRows, buddy, canFetchMore, changePersistentIndex, changePersistentIndexList, columnCount, columnCount, createIndex, createIndex, createIndex, data, data, data, data, dropMimeData, endInsertColumns, endInsertRows, endRemoveColumns, endRemoveRows, fetchMore, flags, hasChildren, hasChildren, hasIndex, hasIndex, headerData, headerData, index, index, insertColumn, insertColumn, insertColumns, insertColumns, insertRow, insertRow, insertRows, insertRows, itemData, match, match, match, match, mimeData, mimeTypes, parent, persistentIndexList, removeColumn, removeColumn, removeColumns, removeColumns, removeRow, removeRow, removeRows, removeRows, reset, revert, rowCount, rowCount, setData, setData, setData, setData, setHeaderData, setHeaderData, setItemData, setSupportedDragActions, setSupportedDragActions, sibling, sort, sort, span, submit, supportedDragActions, supportedDropActions
 
Methods inherited from class com.trolltech.qt.core.QObject
childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, indexOfProperty, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, properties, property, removeEventFilter, setObjectName, setParent, setProperty, startTimer, timerEvent, toString, userProperty
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread
 
Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
__qt_signalInitialization
 
Methods inherited from class java.lang.Object
clone, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Constructor Detail

QAbstractProxyModel

public QAbstractProxyModel()
Constructs a proxy model with the given parent.


QAbstractProxyModel

public QAbstractProxyModel(QObject parent)
Constructs a proxy model with the given parent.

Method Detail

sourceModel

public final QAbstractItemModel sourceModel()
Returns the model that contains the data that is available through the proxy model.

See also:
setSourceModel().


mapFromSource

public abstract com.trolltech.qt.core.QModelIndex mapFromSource(com.trolltech.qt.core.QModelIndex sourceIndex)
Reimplement this function to return the model index in the proxy model that corresponds to the sourceIndex from the source model.

See also:
mapToSource().


mapSelectionFromSource

public QItemSelection mapSelectionFromSource(QItemSelection selection)
Returns a proxy selection mapped from the specified sourceSelection.

Reimplement this method to map source selections to proxy selections.


mapSelectionToSource

public QItemSelection mapSelectionToSource(QItemSelection selection)
Returns a source selection mapped from the specified proxySelection.

Reimplement this method to map proxy selections to source selections.


mapToSource

public abstract com.trolltech.qt.core.QModelIndex mapToSource(com.trolltech.qt.core.QModelIndex proxyIndex)
Reimplement this function to return the model index in the source model that corresponds to the proxyIndex in the proxy model.

See also:
mapFromSource().


setSourceModel

public void setSourceModel(QAbstractItemModel sourceModel)
Sets the given sourceModel to be processed by the proxy model.

See also:
sourceModel().