pans
2016-12-15 87e3ee273b2f84081ac45926be9d8e5be3166eaa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/***************************************************************************************
 *      Copyright 2009-2011 Hikvision Digital Technology Co., Ltd.
 *      FileName        :       treeitem.h
 *      Description     :       Ê÷ÐÍÏÔʾ½ÚµãÍ·Îļþ
 *      Modification    :       ÎÞ
 *      Version         :       V1.0.0
 *      Time            :       2009-10,11
 *      Author          :       wanggp@hikvision.com
 **************************************************************************************/
 
 
#include <QStringList>
#include <QMessageBox>
#include "treeitem.h"
 
/************************************************************************
*        Function            :  TreeItem
*        Description         :  ¹¹Ô캯Êý
*        Input               :  data,parent
*        Output              :  ÎÞ
*        Return              :  ÎÞ
*************************************************************************/
TreeItem::TreeItem(const QList<QVariant> &data, TreeItem *parent)
{
    parentItem = parent;
    itemData = data;
}
 
/************************************************************************
*        Function            :  ~TreeItem
*        Description         :  Îö¹¹º¯Êý
*        Input               :  ÎÞ
*        Output              :  ÎÞ
*        Return              :  ÎÞ
*************************************************************************/
TreeItem::~TreeItem()
{
    qDeleteAll(childItems);
}
 
/************************************************************************
*        Function            :  appendChild
*        Description         :  Ìí¼Ó½Úµã
*        Input               :  item
*        Output              :  ÎÞ
*        Return              :  ÎÞ
*************************************************************************/
void TreeItem::appendChild(TreeItem *item)
{
    childItems.append(item);
}
 
/************************************************************************
*        Function            :  child
*        Description         :  È¡º¢×Ó½áµã
*        Input               :  row
*        Output              :  ÎÞ
*        Return              :  childItems
*************************************************************************/
TreeItem *TreeItem::child(int row)
{
    return childItems.value(row);
}
 
/************************************************************************
*        Function            :  childCount
*        Description         :  ×Ó½Úµã¼ÆÊý
*        Input               :  ÎÞ
*        Output              :  ÎÞ
*        Return              :  ÎÞ
*************************************************************************/
int TreeItem::childCount() const
{
    return childItems.count();
}
 
/************************************************************************
*        Function            :  columnCount
*        Description         :  ÁÐÊý¼ÆÊý
*        Input               :  ÎÞ
*        Output              :  ÎÞ
*        Return              :  ×Ó½ÚµãµÄ×ܸöÊý
*************************************************************************/
int TreeItem::columnCount() const
{
    return itemData.count();
}
 
/************************************************************************
*        Function            :  data
*        Description         :  Ä³Ò»ÁÐÊý¾Ý
*        Input               :  column
*        Output              :  ÎÞ
*        Return              :  itemData.value
*************************************************************************/ 
QVariant TreeItem::data(int column) const
{
    QString data =itemData.value(column).toString();
    //QMessageBox::information(this,tr("TreeItem::data"),tr("data=%1").arg(data.toLatin1().data()));
    //printf("%s\n",data.toLatin1().data());
    return itemData.value(column);
}
 
bool TreeItem::setData(const QVariant &value)
{
    //printf("1232434534555=%s\n",value.toString().toLatin1().data());
      //itemData.clear();
    //itemData.append(value);
    //printf("1232434534555=%s\n",value.toString().toLatin1().data());
        
         return true;
     
    // return false;
 
 
}
 
/************************************************************************
*        Function            :  parent
*        Description         :  È¡Æä¸¸½Úµã
*        Input               :  ÎÞ
*        Output              :  ÎÞ
*        Return              :  parentItem
*************************************************************************/
TreeItem *TreeItem::parent()
{
    return parentItem;
}
 
/************************************************************************
*        Function            :  row
*        Description         :  Í³¼ÆÐÐÊý
*        Input               :  ÎÞ
*        Output              :  ÎÞ
*        Return              :  0 
*************************************************************************/
int TreeItem::row() const
{
    if (parentItem)
    {
        return parentItem->childItems.indexOf(const_cast<TreeItem*>(this));
    }
    return 0;
}