/usr/include/kbreadcrumbselectionmodel.h is in kdelibs5-dev 4:4.14.2-5+deb8u2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | /*
Copyright (C) 2010 Klarälvdalens Datakonsult AB,
a KDAB Group company, info@kdab.net,
author Stephen Kelly <stephen@kdab.com>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef KBREADCRUMBSPROXYMODEL_H
#define KBREADCRUMBSPROXYMODEL_H
#include <QtGui/QItemSelectionModel>
#include <QtCore/QAbstractItemModel>
#include "kdeui_export.h"
class KBreadcrumbSelectionModelPrivate;
/**
@class KBreadcrumbSelectionModel kbreadcrumbselectionmodel.h
@brief 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.
@code
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);
@endcode
@image html kbreadcrumbselectionmodel.png "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 @p this.
@since 4.5
*/
class KDEUI_EXPORT KBreadcrumbSelectionModel : public QItemSelectionModel
{
Q_OBJECT
public:
enum BreadcrumbTarget
{
MakeBreadcrumbSelectionInOther,
MakeBreadcrumbSelectionInSelf
};
explicit KBreadcrumbSelectionModel(QItemSelectionModel *selectionModel, QObject* parent = 0);
KBreadcrumbSelectionModel(QItemSelectionModel *selectionModel, BreadcrumbTarget target, QObject* parent = 0);
virtual ~KBreadcrumbSelectionModel();
/**
Returns whether the actual selection in included in the proxy.
The default is true.
*/
bool isActualSelectionIncluded() const;
/**
Set whether the actual selection in included in the proxy to @p isActualSelectionIncluded.
*/
void setActualSelectionIncluded(bool isActualSelectionIncluded);
/**
Returns the depth that the breadcrumb selection should go to.
*/
int breadcrumbLength() const;
/**
Sets the depth that the breadcrumb selection should go to.
If the @p breadcrumbLength is -1, all breadcrumbs are selected.
The default is -1
*/
void setBreadcrumbLength(int breadcrumbLength);
/* reimp */ void select(const QModelIndex &index, QItemSelectionModel::SelectionFlags command);
/* reimp */ void select(const QItemSelection &selection, QItemSelectionModel::SelectionFlags command);
protected:
KBreadcrumbSelectionModelPrivate * const d_ptr;
private:
//@cond PRIVATE
Q_DECLARE_PRIVATE(KBreadcrumbSelectionModel)
Q_PRIVATE_SLOT( d_func(),void sourceSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected))
Q_PRIVATE_SLOT( d_func(),void syncBreadcrumbs())
//@cond PRIVATE
};
#endif
|