• 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
treemodel.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_TREEMODEL_H
23 #define KDEVPLATFORM_TREEMODEL_H
24 
25 #include <QAbstractItemModel>
26 #include <QModelIndex>
27 #include <QVariant>
28 #include <QVector>
29 #include <QString>
30 
31 #include <debugger/debuggerexport.h>
32 
33 namespace KDevelop {
34 
35 class TreeItem;
36 class TreeModelPrivate;
37 
38 class KDEVPLATFORMDEBUGGER_EXPORT TreeModel : public QAbstractItemModel
39 {
40  Q_OBJECT
41 
42 public:
43  explicit TreeModel(const QVector<QString>& headers, QObject *parent = nullptr);
44  void setRootItem(TreeItem *item);
45  ~TreeModel() override;
46 
47  void expanded(const QModelIndex &index);
48  void collapsed(const QModelIndex &index);
49  void clicked(const QModelIndex &index);
50 
51  void setEditable(bool);
52  TreeItem* root() const;
53 
54  enum {
55  ItemRole = Qt::UserRole,
56  };
57 
58 public: // QAbstractItemModel overrides
59  QVariant data(const QModelIndex &index, int role) const override;
60  Qt::ItemFlags flags(const QModelIndex &index) const override;
61  QVariant headerData(int section, Qt::Orientation orientation,
62  int role = Qt::DisplayRole) const override;
63  QModelIndex index(int row, int column,
64  const QModelIndex &parent = QModelIndex()) const override;
65  QModelIndex parent(const QModelIndex &index) const override;
66  int rowCount(const QModelIndex &parent = QModelIndex()) const override;
67  int columnCount(const QModelIndex &parent = QModelIndex()) const override;
68  bool setData(const QModelIndex& index, const QVariant& value,
69  int role) override;
70 
71 Q_SIGNALS:
72  void itemChildrenReady();
73 
74 public:
75  TreeItem* itemForIndex(const QModelIndex& index) const;
76  QModelIndex indexForItem(TreeItem *item, int column) const;
77 
78  using QAbstractItemModel::beginInsertRows;
79  using QAbstractItemModel::endInsertRows;
80  using QAbstractItemModel::beginRemoveRows;
81  using QAbstractItemModel::endRemoveRows;
82  using QAbstractItemModel::dataChanged;
83 
84 private:
85  const QScopedPointer<class TreeModelPrivate> d_ptr;
86  Q_DECLARE_PRIVATE(TreeModel)
87 };
88 
89 }
90 
91 #endif
QAbstractItemModel::beginRemoveRows
void beginRemoveRows(const QModelIndex &parent, int first, int last)
KDevelop::TreeModel
Definition: treemodel.h:38
QAbstractItemModel::beginInsertRows
void beginInsertRows(const QModelIndex &parent, int first, int last)
QObject
KDevelop::TreeItem
Definition: treeitem.h:37
QAbstractItemModel::dataChanged
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
QAbstractItemModel::endInsertRows
void endInsertRows()
QScopedPointer< class TreeModelPrivate >
QAbstractItemModel::endRemoveRows
void endRemoveRows()
KDevelop
The variables widget is passive, and is invoked by the rest of the code via two main Q_SLOTS:
Definition: breakpoint.h:34
QModelIndex
Qt::ItemFlags
typedef ItemFlags
QVector< QString >
QVariant
QAbstractItemModel
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