KDE 4.9 PyKDE API Reference

- KDE's Python API

# KBreadcrumbSelectionModel Class Reference

`from PyKDE4.kdeui import *`

Inherits: QItemSelectionModel → QObject

## Detailed Description

KBreadcrumbSelectionModel kbreadcrumbselectionmodel.h

Selects the parents of selected items to create breadcrumbs

For example, if the tree is @verbatim - A - B - - C - - D - - - E - - - - F @endverbatim

and E is selected, the selection can contain

@verbatim - B - D @endverbatim

or

@verbatim - B - D - E @endverbatim

if isActualSelectionIncluded is true.

The depth of the selection may also be set. For example if the breadcrumbLength is 1:

@verbatim - D - E @endverbatim

And if breadcrumbLength is 2:

@verbatim - B - D - E @endverbatim

A KBreadcrumbsProxyModel with a breadcrumbLength of 0 and including the actual selection is the same as a KSelectionProxyModel in the KSelectionProxyModel.ExactSelection configuration.

    view1->setModel(rootModel);

    QItemSelectionModel *breadcrumbSelectionModel = new QItemSelectionModel(rootModel, this);

    KBreadcrumbSelectionModel *breadcrumbProxySelector = new KBreadcrumbSelectionModel(breadcrumbSelectionModel, rootModel, this);

    view1->setSelectionModel(breadcrumbProxySelector);

    KSelectionProxyModel *breadcrumbSelectionProxyModel = new KSelectionProxyModel( breadcrumbSelectionModel, this);
    breadcrumbSelectionProxyModel->setSourceModel( rootModel );
    breadcrumbSelectionProxyModel->setFilterBehavior( KSelectionProxyModel.ExactSelection );

    view2->setModel(breadcrumbSelectionProxyModel);

"KBreadcrumbSelectionModel in several configurations"

This can work in two directions. One option is for a single selection in the KBreadcrumbSelectionModel to invoke the breadcrumb selection in its constructor argument.

The other is for a selection in the itemselectionmodel in the constructor argument to cause a breadcrumb selection in this.

Since:
  4.5

## Enumerations
BreadcrumbTarget | { MakeBreadcrumbSelectionInOther, MakeBreadcrumbSelectionInSelf }
## Methods
| __init__ (self, QItemSelectionModel selectionModel, QObject parent=0)
| __init__ (self, QItemSelectionModel selectionModel, KBreadcrumbSelectionModel.BreadcrumbTarget target, QObject parent=0)
int | breadcrumbLength (self)
bool | isActualSelectionIncluded (self)
| select (self, QModelIndex index, QItemSelectionModel::SelectionFlags command)
| select (self, QItemSelection selection, QItemSelectionModel::SelectionFlags command)
| setActualSelectionIncluded (self, bool isActualSelectionIncluded)
| setBreadcrumbLength (self, int breadcrumbLength)

## Method Documentation

__init__ | ( | self, |
|  | QItemSelectionModel | selectionModel,
|  | QObject | parent=0
| ) |  |  |

__init__ | ( | self, |
|  | QItemSelectionModel | selectionModel,
|  | KBreadcrumbSelectionModel.BreadcrumbTarget | target,
|  | QObject | parent=0
| ) |  |  |

int breadcrumbLength | ( |  | self ) |

Returns the depth that the breadcrumb selection should go to.

bool isActualSelectionIncluded | ( |  | self ) |

Returns whether the actual selection in included in the proxy.

The default is true.

select | ( | self, |
|  | QModelIndex | index,
|  | QItemSelectionModel::SelectionFlags | command
| ) |  |  |

select | ( | self, |
|  | QItemSelection | selection,
|  | QItemSelectionModel::SelectionFlags | command
| ) |  |  |

setActualSelectionIncluded | ( | self, |
|  | bool | isActualSelectionIncluded
| ) |  |  |

Set whether the actual selection in included in the proxy to isActualSelectionIncluded.

setBreadcrumbLength | ( | self, |
|  | int | breadcrumbLength
| ) |  |  |

Sets the depth that the breadcrumb selection should go to.

If the breadcrumbLength is -1, all breadcrumbs are selected. The default is -1

## Enumeration Documentation

BreadcrumbTarget

Enumerator:

  MakeBreadcrumbSelectionInOther |
  MakeBreadcrumbSelectionInSelf |