source: calamares/trunk/fuentes/src/calamares/progresstree/ProgressTreeModel.h @ 7538

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

sync with github

File size: 2.1 KB
Line 
1/* === This file is part of Calamares - <https://github.com/calamares> ===
2 *
3 *   Copyright 2014, Teo Mrnjavac <teo@kde.org>
4 *   Copyright 2017, Adriaan de Groot <groot@kde.org>
5 *
6 *   Calamares is free software: you can redistribute it and/or modify
7 *   it under the terms of the GNU General Public License as published by
8 *   the Free Software Foundation, either version 3 of the License, or
9 *   (at your option) any later version.
10 *
11 *   Calamares 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 License
17 *   along with Calamares. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef PROGRESSTREEMODEL_H
21#define PROGRESSTREEMODEL_H
22
23#include <QAbstractItemModel>
24
25class ProgressTreeRoot;
26class ProgressTreeItem;
27
28
29/**
30 * @brief The ProgressTreeModel class implements a model for the ProgressTreeView.
31 */
32class ProgressTreeModel : public QAbstractItemModel
33{
34    Q_OBJECT
35public:
36    enum Role
37    {
38        ProgressTreeItemRole        = Qt::UserRole + 10,
39        ProgressTreeItemCurrentRole = Qt::UserRole + 11
40    };
41
42    explicit ProgressTreeModel( QObject* parent = nullptr );
43    virtual ~ProgressTreeModel() override;
44
45    // Reimplemented from QAbstractItemModel
46    Qt::ItemFlags flags( const QModelIndex& index ) const override;
47    QModelIndex index( int row, int column, const QModelIndex& parent = QModelIndex() ) const override;
48    QModelIndex parent( const QModelIndex& index ) const override;
49    QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const override;
50    QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const override;
51    int rowCount( const QModelIndex& parent = QModelIndex() ) const override;
52    int columnCount( const QModelIndex& parent = QModelIndex() ) const override;
53
54private:
55    void setupModelData();
56    QModelIndex indexFromItem( ProgressTreeItem* item );
57
58    ProgressTreeRoot* m_rootItem;
59};
60
61#endif // PROGRESSTREEMODEL_H
Note: See TracBrowser for help on using the repository browser.