• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KDEUI

  • kdeui
  • itemviews
kselectionproxymodel.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2009 Stephen Kelly <steveire@gmail.com>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18*/
19
20#ifndef KSELECTIONPROXYMODEL_H
21#define KSELECTIONPROXYMODEL_H
22
23#include <QtGui/QAbstractProxyModel>
24
25#include <kdeui_export.h>
26
27class QItemSelectionModel;
28
29class KSelectionProxyModelPrivate;
30
86class KDEUI_EXPORT KSelectionProxyModel : public QAbstractProxyModel
87{
88 Q_OBJECT
89public:
96 explicit KSelectionProxyModel(QItemSelectionModel *selectionModel, QObject *parent = 0);
97
101 virtual ~KSelectionProxyModel();
102
106 virtual void setSourceModel(QAbstractItemModel * sourceModel);
107
108 QItemSelectionModel *selectionModel() const;
109
110 enum FilterBehavior {
111 SubTrees,
112 SubTreeRoots,
113 SubTreesWithoutRoots,
114 ExactSelection,
115 ChildrenOfExactSelection
116 };
117 Q_ENUMS(FilterBehavior)
118
119
233 void setFilterBehavior(FilterBehavior behavior);
234 FilterBehavior filterBehavior() const;
235
236 QModelIndex mapFromSource(const QModelIndex & sourceIndex) const;
237 QModelIndex mapToSource(const QModelIndex & proxyIndex) const;
238
239 QItemSelection mapSelectionFromSource(const QItemSelection& selection) const;
240 QItemSelection mapSelectionToSource(const QItemSelection& selection) const;
241
242 virtual Qt::ItemFlags flags(const QModelIndex &index) const;
243 QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
244 virtual int rowCount(const QModelIndex & parent = QModelIndex()) const;
245 virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
246
247 virtual QMimeData* mimeData(const QModelIndexList & indexes) const;
248 virtual QStringList mimeTypes() const;
249 virtual Qt::DropActions supportedDropActions() const;
250 virtual bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent);
251
252 virtual bool hasChildren(const QModelIndex & parent = QModelIndex()) const;
253 virtual QModelIndex index(int, int, const QModelIndex& = QModelIndex()) const;
254 virtual QModelIndex parent(const QModelIndex&) const;
255 virtual int columnCount(const QModelIndex& = QModelIndex()) const;
256
257 virtual QModelIndexList match(const QModelIndex& start, int role, const QVariant& value, int hits = 1,
258 Qt::MatchFlags flags = Qt::MatchFlags(Qt::MatchStartsWith | Qt::MatchWrap)) const;
259
260Q_SIGNALS:
261#if !defined(Q_MOC_RUN) && !defined(DOXYGEN_SHOULD_SKIP_THIS) && !defined(IN_IDE_PARSER)
262private: // Don't allow subclasses to emit these signals.
263#endif
264
271 void rootIndexAboutToBeRemoved(const QModelIndex &removeRootIndex);
272
279 void rootIndexAdded(const QModelIndex &newIndex);
280
286 void rootSelectionAboutToBeRemoved(const QItemSelection &selection);
287
293 void rootSelectionAdded(const QItemSelection &selection);
294
295protected:
296 QList<QPersistentModelIndex> sourceRootIndexes() const;
297
298private:
299 Q_DECLARE_PRIVATE(KSelectionProxyModel)
300 //@cond PRIVATE
301 KSelectionProxyModelPrivate *d_ptr;
302
303 Q_PRIVATE_SLOT(d_func(), void sourceRowsAboutToBeInserted(const QModelIndex &, int, int))
304 Q_PRIVATE_SLOT(d_func(), void sourceRowsInserted(const QModelIndex &, int, int))
305 Q_PRIVATE_SLOT(d_func(), void sourceRowsAboutToBeRemoved(const QModelIndex &, int, int))
306 Q_PRIVATE_SLOT(d_func(), void sourceRowsRemoved(const QModelIndex &, int, int))
307 Q_PRIVATE_SLOT(d_func(), void sourceRowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int))
308 Q_PRIVATE_SLOT(d_func(), void sourceRowsMoved(const QModelIndex &, int, int, const QModelIndex &, int))
309 Q_PRIVATE_SLOT(d_func(), void sourceModelAboutToBeReset())
310 Q_PRIVATE_SLOT(d_func(), void sourceModelReset())
311 Q_PRIVATE_SLOT(d_func(), void sourceLayoutAboutToBeChanged())
312 Q_PRIVATE_SLOT(d_func(), void sourceLayoutChanged())
313 Q_PRIVATE_SLOT(d_func(), void sourceDataChanged(const QModelIndex &, const QModelIndex &))
314 Q_PRIVATE_SLOT(d_func(), void selectionChanged(const QItemSelection & selected, const QItemSelection & deselected))
315 Q_PRIVATE_SLOT(d_func(), void sourceModelDestroyed())
316
317 //@endcond
318
319};
320
321#endif
KSelectionProxyModel
A Proxy Model which presents a subset of its source model to observers.
Definition: kselectionproxymodel.h:87
KSelectionProxyModel::rootSelectionAdded
void rootSelectionAdded(const QItemSelection &selection)
KSelectionProxyModel::rootSelectionAboutToBeRemoved
void rootSelectionAboutToBeRemoved(const QItemSelection &selection)
KSelectionProxyModel::FilterBehavior
FilterBehavior
Definition: kselectionproxymodel.h:110
KSelectionProxyModel::ExactSelection
@ ExactSelection
Definition: kselectionproxymodel.h:114
KSelectionProxyModel::SubTrees
@ SubTrees
Definition: kselectionproxymodel.h:111
KSelectionProxyModel::SubTreesWithoutRoots
@ SubTreesWithoutRoots
Definition: kselectionproxymodel.h:113
KSelectionProxyModel::SubTreeRoots
@ SubTreeRoots
Definition: kselectionproxymodel.h:112
KSelectionProxyModel::rootIndexAdded
void rootIndexAdded(const QModelIndex &newIndex)
KSelectionProxyModel::rootIndexAboutToBeRemoved
void rootIndexAboutToBeRemoved(const QModelIndex &removeRootIndex)
QAbstractItemModel
QAbstractProxyModel
QItemSelectionModel
QList
QObject
kdeui_export.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal