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

kdevplatform/debugger

  • sources
  • kfour-appscomplete
  • kdevelop
  • kdevplatform
  • debugger
  • util
treeitem.h
Go to the documentation of this file.
1 /*
2  * This file is part of KDevelop
3  *
4  * Copyright 2008 Vladimir Prus <[email protected]>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of the
9  * License, or (at your option) any later version.
10  *
11  * This program 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
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public
17  * License along with this program; if not, write to the
18  * Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  */
21 
22 #ifndef KDEVPLATFORM_TREEITEM_H
23 #define KDEVPLATFORM_TREEITEM_H
24 
25 #include <QVariant>
26 #include <QVector>
27 #include <QIcon>
28 
29 #include <iostream>
30 
31 #include <debugger/debuggerexport.h>
32 
33 namespace KDevelop {
34 
35 class TreeModel;
36 
37 class KDEVPLATFORMDEBUGGER_EXPORT TreeItem: public QObject
38 {
39  Q_OBJECT
40 public:
41  ~TreeItem() override;
42 
43 // FIXME: should be protected
44 public: // Methods that the derived classes should implement
45 
49  virtual void fetchMoreChildren()=0;
50 
51  virtual void setColumn(int index, const QVariant& data) { Q_UNUSED(index); Q_UNUSED(data); }
52  void emitAllChildrenFetched();
53 
54 protected: // Interface for derived classes
55 
60  explicit TreeItem(TreeModel* model, TreeItem *parent = nullptr);
61 
63  void setData(const QVector<QVariant> &data);
64 
67  void appendChild(TreeItem *child, bool initial = false);
68 
69  void insertChild(int position, TreeItem *child, bool initial = false);
70 
71  void removeChild(int index);
72 
73  void removeSelf();
74 
75  void deleteChildren();
76 
78  void reportChange();
79  void reportChange(int column);
80 
82  void clear();
83 
86  void setHasMore(bool more);
87 
88  void setHasMoreInitial(bool more);
89 
90  TreeModel* model() { return model_; }
91 
92  bool isExpanded() const { return expanded_; }
93 
94 Q_SIGNALS:
95  void expanded();
96  void collapsed();
97  void allChildrenFetched();
98 
99 protected: // Backend implementation of Model/View
100  friend class TreeModel;
101 
102  TreeItem *child(int row);
103  int childCount() const;
104  int columnCount() const;
105  virtual QVariant data(int column, int role) const;
106  int row() const;
107  TreeItem *parent();
108  bool hasMore() const { return more_; }
109  void setExpanded(bool b);
110 
111  virtual void clicked() {}
112  virtual QVariant icon(int column) const;
113 
114 protected:
115  QVector<TreeItem*> childItems;
116  QVector<QVariant> itemData;
117  TreeItem *parentItem;
118  TreeModel *model_;
119  bool more_;
120  TreeItem *ellipsis_;
121  bool expanded_;
122 };
123 
124 }
125 
126 #endif
KDevelop::TreeItem::hasMore
bool hasMore() const
Definition: treeitem.h:108
KDevelop::TreeItem::setColumn
virtual void setColumn(int index, const QVariant &data)
Definition: treeitem.h:51
KDevelop::TreeItem::expanded_
bool expanded_
Definition: treeitem.h:121
KDevelop::TreeItem::isExpanded
bool isExpanded() const
Definition: treeitem.h:92
KDevelop::TreeItem::model_
TreeModel * model_
Definition: treeitem.h:118
KDevelop::TreeModel
Definition: treemodel.h:38
KDevelop::TreeItem::parentItem
TreeItem * parentItem
Definition: treeitem.h:117
QObject
KDevelop::TreeItem::model
TreeModel * model()
Definition: treeitem.h:90
KDevelop::TreeItem
Definition: treeitem.h:37
KDevelop::TreeItem::more_
bool more_
Definition: treeitem.h:119
KDevelop::TreeItem::ellipsis_
TreeItem * ellipsis_
Definition: treeitem.h:120
KDevelop
The variables widget is passive, and is invoked by the rest of the code via two main Q_SLOTS:
Definition: breakpoint.h:34
KDevelop::TreeItem::itemData
QVector< QVariant > itemData
Definition: treeitem.h:116
QVector< QVariant >
QVariant
KDevelop::TreeItem::clicked
virtual void clicked()
Definition: treeitem.h:111
KDevelop::TreeItem::childItems
QVector< TreeItem * > childItems
Definition: treeitem.h:115
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Apr 10 2021 23:29:51 by doxygen 1.8.16 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kdevplatform/debugger

Skip menu "kdevplatform/debugger"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdevelop API Reference

Skip menu "kdevelop API Reference"
  • kdevplatform
  •   debugger
  •   documentation
  •   interfaces
  •   language
  •     assistant
  •     backgroundparser
  •     checks
  •     classmodel
  •     codecompletion
  •     codegen
  •     duchain
  •     editor
  •     highlighting
  •     interfaces
  •     util
  •   outputview
  •   project
  •   serialization
  •   shell
  •   sublime
  •   tests
  •   util
  •   vcs

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