KBreadcrumbSelectionModel

Search for usage in LXR

KBreadcrumbSelectionModel Class Reference

#include <KBreadcrumbSelectionModel>

Detailed Description

Selects the parents of selected items to create breadcrumbs.

For example, if the tree is

  - A
  - B
  - - C
  - - D
  - - - E
  - - - - F

and E is selected, the selection can contain

  - B
  - D

or

  - B
  - D
  - E

if isActualSelectionIncluded is true.

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

  - D
  - E

And if breadcrumbLength is 2:

  - B
  - D
  - E

A KBreadcrumbsSelectionModel 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);
Selects the parents of selected items to create breadcrumbs.
A Proxy Model which presents a subset of its source model to observers.
void setFilterBehavior(FilterBehavior behavior)
Set the filter behaviors of this model.
void setSourceModel(QAbstractItemModel *sourceModel) override
reimp.
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

The documentation for this class was generated from the following file:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:07:00 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.