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

Nepomuk-Core

  • KTp
  • Models
abstract-grouping-proxy-model.h
Go to the documentation of this file.
1 /*
2  * Turns a list model into a tree allowing nodes to be in multiple groups
3  *
4  * Copyright (C) 2012 David Edmundson <kde@davidedmundson.co.uk>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 
22 #ifndef KTP_ABSTRACT_GROUPING_PROXY_MODEL_H
23 #define KTP_ABSTRACT_GROUPING_PROXY_MODEL_H
24 
25 #include <QStandardItemModel>
26 
27 #include <KTp/ktp-export.h>
28 
29 class ProxyNode;
30 class GroupNode;
31 
32 namespace KTp
33 {
34 
35 class KTP_EXPORT AbstractGroupingProxyModel : public QStandardItemModel
36 {
37  Q_OBJECT
38 public:
39  explicit AbstractGroupingProxyModel(QAbstractItemModel *source);
40  virtual ~AbstractGroupingProxyModel();
41 
42  void forceGroup(const QString &group);
43  void unforceGroup(const QString &group);
44 
45  void groupChanged(const QString &group);
46 
47 //protected:
49  virtual QSet<QString> groupsForIndex(const QModelIndex &sourceIndex) const = 0;
51  virtual QVariant dataForGroup(const QString &group, int role) const = 0;
52 
53 private Q_SLOTS:
54  void onRowsInserted(const QModelIndex &sourceParent, int start, int end);
55  void onRowsRemoved(const QModelIndex &sourceParent, int start, int end);
56  void onDataChanged(const QModelIndex &sourceTopLeft, const QModelIndex &sourceBottomRight);
57  void onModelReset();
58  void onLoad();
59 
60 private:
61  Q_DISABLE_COPY(AbstractGroupingProxyModel)
62  class Private;
63  Private *d;
64 
65 
67  void addProxyNode(const QModelIndex &sourceIndex, QStandardItem *parent);
68 
69  void removeProxyNodes(const QModelIndex &sourceIndex, const QList<ProxyNode *> &removedItems);
70 
71 
73  GroupNode *itemForGroup(const QString &group);
74 };
75 
76 }
77 
78 #endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Fri Mar 22 2013 10:58:52 by doxygen 1.8.1.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

ktp-common-internals API Reference

Skip menu "ktp-common-internals API Reference"
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