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

liblancelot

  • sources
  • kde-4.14
  • workspace
  • kdeplasma-addons
  • libs
  • lancelot
  • models
StandardActionTreeModel.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2007, 2008, 2009, 2010 Ivan Cukic <ivan.cukic(at)kde.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser/Library General Public License version 2,
6  * or (at your option) any later version, as published by the Free
7  * Software Foundation
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser/Library General Public License for more details
13  *
14  * You should have received a copy of the GNU Lesser/Library General Public
15  * License along with this program; if not, write to the
16  * Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef LANCELOT_STANDARD_ACTION_TREE_MODEL_H
21 #define LANCELOT_STANDARD_ACTION_TREE_MODEL_H
22 
23 #include "ActionTreeModel.h"
24 
25 #include <lancelot/lancelot_export.h>
26 
27 namespace Lancelot
28 {
29 
30 class LANCELOT_EXPORT StandardActionTreeModel: public ActionTreeModel {
31 protected:
35  class LANCELOT_EXPORT Item { //krazy:exclude=dpointer
36  public:
37  explicit Item(QString itemTitle = QString(),
38  QString itemDescription = QString(),
39  QIcon itemIcon = QIcon(),
40  QVariant itemData = QVariant());
41 
42  ~Item();
43 
44  QString title;
45  QString description;
46  QIcon icon;
47  QVariant data;
48 
49  QList < Item * > children;
50  };
51 
52  StandardActionTreeModel(Item * root);
53 
54  Item * root() const;
55  virtual StandardActionTreeModel * createChild(int index) = 0;
56 
57 
58 public:
59  StandardActionTreeModel();
60 
61  virtual ~StandardActionTreeModel();
62 
63  // ActionTreeModel
64  L_Override ActionTreeModel * child(int index);
65  L_Override QString selfTitle() const;
66  L_Override QIcon selfIcon() const;
67 
68  // ActionListModel
69  L_Override QString title(int index) const;
70  L_Override QString description(int index) const;
71  L_Override QIcon icon(int index) const;
72  L_Override bool isCategory(int index) const;
73 
74  L_Override int size() const;
75 
76  QVariant data(int index) const;
77 
82  void add(Item * item, Item * parent = NULL);
83 
91  void add(const QString & title, const QString & description,
92  QIcon icon, const QVariant & data, Item * parent = NULL);
93 
99  void set(int index, Item * item, Item * parent = NULL);
100 
109  void set(int index, const QString & title, const QString & description,
110  QIcon icon, const QVariant & data, Item * parent = NULL);
111 
116  void removeAt(int index, Item * parent = NULL);
117 
122  Item * itemAt(int index, Item * parent = NULL);
123 
127  void clear(Item * parent = NULL);
128 
129 private:
130  class Private;
131  Private * const d;
132 
133 };
134 
135 } // namespace Lancelot
136 
137 #endif /* LANCELOT_STANDARD_ACTION_TREE_MODEL_H */
138 
Lancelot::StandardActionTreeModel
Definition: StandardActionTreeModel.h:30
Lancelot::StandardActionTreeModel::Item::data
QVariant data
Definition: StandardActionTreeModel.h:47
Lancelot::StandardActionTreeModel::Item::children
QList< Item * > children
Definition: StandardActionTreeModel.h:49
L_Override
#define L_Override
Definition: lancelot_export.h:41
lancelot_export.h
Lancelot::StandardActionTreeModel::Item
This class represents an item in the list model.
Definition: StandardActionTreeModel.h:35
LANCELOT_EXPORT
#define LANCELOT_EXPORT
Definition: lancelot_export.h:32
QString
QList
Lancelot::ActionTreeModel
Definition: ActionTreeModel.h:30
Lancelot::StandardActionTreeModel::Item::icon
QIcon icon
Definition: StandardActionTreeModel.h:46
Lancelot::StandardActionTreeModel::Item::title
QString title
Definition: StandardActionTreeModel.h:44
ActionTreeModel.h
Lancelot::StandardActionTreeModel::Item::description
QString description
Definition: StandardActionTreeModel.h:45
QIcon
QVariant
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:43:01 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

liblancelot

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

workspace API Reference

Skip menu "workspace API Reference"
  • kdeplasma-addons
  •       GroupingDesktop
  •     liblancelot

Search



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