NCL Composer
0.1.5
Main Page
Related Pages
Classes
All
Classes
Functions
Variables
Pages
TreeItem.cpp
1
/*
2
* Copyright 2011 TeleMidia/PUC-Rio.
3
*
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Lesser General Public
6
* License as published by the Free Software Foundation; either
7
* version 2.1 of the License, or (at your option) any later version.
8
*
9
* This library 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 GNU
12
* Lesser General Public License for more details.
13
*
14
* You should have received a copy of the GNU Lesser General Public
15
* License along with this library. If not, see
16
* <http://www.gnu.org/licenses/>.
17
*/
18
/*
19
treeitem.cpp
20
21
A container for items of data supplied by the simple tree model.
22
*/
23
24
#include <QStringList>
25
26
#include "TreeItem.h"
27
28
TreeItem::TreeItem(
const
QList<QVariant> &data,
TreeItem
*parent)
29
{
30
parentItem = parent;
31
itemData = data;
32
}
33
34
TreeItem::~TreeItem()
35
{
36
qDeleteAll(childItems);
37
}
38
39
void
TreeItem::appendChild(
TreeItem
*item)
40
{
41
childItems.append(item);
42
}
43
44
TreeItem
*TreeItem::child(
int
row)
45
{
46
return
childItems.value(row);
47
}
48
49
int
TreeItem::childCount()
const
50
{
51
return
childItems.count();
52
}
53
54
int
TreeItem::columnCount()
const
55
{
56
return
itemData.count();
57
}
58
59
QVariant TreeItem::data(
int
column)
const
60
{
61
return
itemData.value(column);
62
}
63
64
TreeItem
*TreeItem::parent()
65
{
66
return
parentItem;
67
}
68
69
int
TreeItem::row()
const
70
{
71
if
(parentItem)
72
return
parentItem->childItems.indexOf(const_cast<TreeItem*>(
this
));
73
74
return
0;
75
}
composer-plugins
ncl-text-editor
src
TreeItem.cpp
Generated on Tue Jun 18 2013 16:03:02 for NCL Composer by
1.8.4