blob: 4cb72ce64882858925cbc16ca3ebf3d3691d301a [file] [log] [blame]
Yingdi Yu1f824642016-03-20 17:07:22 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (c) 2013-2014, Regents of the University of California,
4 *
5 * This file is part of NFD Control Center. See AUTHORS.md for complete list of NFD
6 * authors and contributors.
7 *
8 * NFD Control Center is free software: you can redistribute it and/or modify it under the
9 * terms of the GNU General Public License as published by the Free Software Foundation,
10 * either version 3 of the License, or (at your option) any later version.
11 *
12 * NFD Control Center is distributed in the hope that it will be useful, but WITHOUT ANY
13 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14 * PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along with NFD
17 * Control Center, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef NDN_NCC_KEY_TREE_MODEL_HPP
21#define NDN_NCC_KEY_TREE_MODEL_HPP
22
23#include <QAbstractItemModel>
24#include <QModelIndex>
25#include <QVariant>
26
27namespace ndn {
28namespace ncc {
29
30class KeyTreeItem;
31
32class KeyTreeModel : public QAbstractItemModel
33{
34 Q_OBJECT
35
36public:
37 explicit
38 KeyTreeModel(QObject* parent = 0);
39
40 ~KeyTreeModel();
41
42 void
43 clear();
44
45 void
46 addChild(KeyTreeItem* child);
47
48 QVariant
49 name(const QModelIndex& index, int role) const;
50
51 QVariant
52 data(const QModelIndex& index, int role) const Q_DECL_OVERRIDE;
53
54 Qt::ItemFlags
55 flags(const QModelIndex& index) const Q_DECL_OVERRIDE;
56
57 QVariant
58 headerData(int section, Qt::Orientation orientation,
59 int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
60
61 QModelIndex
62 index(int row, int column, const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE;
63
64 QModelIndex
65 parent(const QModelIndex& index) const Q_DECL_OVERRIDE;
66
67 int
68 rowCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE;
69
70 int
71 columnCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE;
72
73private:
74 KeyTreeItem* m_rootItem;
75};
76
77} // namespace ncc
78} // namespace ndn
79
80#endif // NDN_NCC_KEY_TREE_MODEL_HPP