source: calamares/trunk/fuentes/src/calamares/progresstree/ProgressTreeItem.cpp @ 7538

Last change on this file since 7538 was 7538, checked in by kbut, 17 months ago

sync with github

File size: 1.8 KB
Line 
1/* === This file is part of Calamares - <https://github.com/calamares> ===
2 *
3 *   Copyright 2014, Teo Mrnjavac <teo@kde.org>
4 *
5 *   Calamares is free software: you can redistribute it and/or modify
6 *   it under the terms of the GNU General Public License as published by
7 *   the Free Software Foundation, either version 3 of the License, or
8 *   (at your option) any later version.
9 *
10 *   Calamares is distributed in the hope that it will be useful,
11 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 *   GNU General Public License for more details.
14 *
15 *   You should have received a copy of the GNU General Public License
16 *   along with Calamares. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include "ProgressTreeItem.h"
20
21#include "ProgressTreeModel.h"
22
23
24ProgressTreeItem::ProgressTreeItem( ProgressTreeItem* parent )
25{
26    m_parentItem = parent;
27}
28
29
30ProgressTreeItem::~ProgressTreeItem()
31{
32    qDeleteAll( m_childItems );
33}
34
35
36void
37ProgressTreeItem::appendChild( ProgressTreeItem* item )
38{
39    m_childItems.append( item );
40}
41
42
43ProgressTreeItem*
44ProgressTreeItem::child( int row )
45{
46    return m_childItems.value( row );
47}
48
49
50int
51ProgressTreeItem::childCount() const
52{
53    return m_childItems.count();
54}
55
56
57int
58ProgressTreeItem::columnCount() const
59{
60    return 1;
61}
62
63
64int
65ProgressTreeItem::row() const
66{
67    if ( m_parentItem )
68        return m_parentItem->m_childItems.indexOf(
69                    const_cast< ProgressTreeItem* >( this ) );
70    return 0;
71}
72
73
74ProgressTreeItem*
75ProgressTreeItem::parent()
76{
77    return m_parentItem;
78}
79
80
81ProgressTreeRoot::ProgressTreeRoot()
82    : ProgressTreeItem()
83{}
84
85
86QVariant
87ProgressTreeRoot::data( int role ) const
88{
89    if ( role == ProgressTreeModel::ProgressTreeItemRole )
90        return this;
91    return QVariant();
92}
Note: See TracBrowser for help on using the repository browser.