KDE 4.5 PyKDE API Reference

- KDE's Python API

# KModelIndexProxyMapper Class Reference

`from PyKDE4.kdeui import *`

Inherits: QObject

## Detailed Description

This class facilitates easy mapping of indexes and selections through proxy models.

In a complex system of proxy models there can be a need to map indexes and selections between them, and sometimes to do so without knowledge of the path from one model to another.

For example,

@verbatim Root model | / \ Proxy 1 Proxy 3 | | Proxy 2 Proxy 4 @endverbatim

If there is a need to map indexes between proxy 2 and proxy 4, a KModelIndexProxyMapper can be created to facilitate mapping of indexes between them.

       m_indexMapper = new KModelIndexProxyMapper(proxy2, proxy4, this);

      ...

       const QModelIndex proxy4Index = m_mapLeftToRight(proxy2->index(0, 0));
       Q_ASSERT(proxy4Index.model() == proxy4);

Note that the aim is to achieve black box connections so that there is no need for application code to know the structure of proxy models in the path between left and right and attempt to manually map them.

@verbatim Root model | --------------- | Black Box | --------------- | | Proxy 2 Proxy 4 @endverbatim

Author:
  Stephen Kelly <steveire@gmail.com>

## Methods
| __init__ (self, QAbstractItemModel leftModel, QAbstractItemModel rightModel, QObject parent=0)
QModelIndex | mapLeftToRight (self, QModelIndex index)
QModelIndex | mapRightToLeft (self, QModelIndex index)
QItemSelection | mapSelectionLeftToRight (self, QItemSelection selection)
QItemSelection | mapSelectionRightToLeft (self, QItemSelection selection)

## Method Documentation

__init__ | ( | self, |
|  | QAbstractItemModel | leftModel,
|  | QAbstractItemModel | rightModel,
|  | QObject | parent=0
| ) |  |  |

Constructor

QModelIndex mapLeftToRight | ( | self, |
|  | QModelIndex | index
| ) |  |  |

Maps the index from the left model to the right model.

QModelIndex mapRightToLeft | ( | self, |
|  | QModelIndex | index
| ) |  |  |

Maps the index from the right model to the left model.

QItemSelection mapSelectionLeftToRight | ( | self, |
|  | QItemSelection | selection
| ) |  |  |

Maps the selection from the left model to the right model.

QItemSelection mapSelectionRightToLeft | ( | self, |
|  | QItemSelection | selection
| ) |  |  |

Maps the selection from the right model to the left model.