File indexing completed on 2024-11-24 03:57:48

0001 /**
0002  * SPDX-FileCopyrightText: 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved.
0003  *
0004  * This file is part of the KGantt library.
0005  *
0006  * SPDX-License-Identifier: GPL-2.0-or-later
0007  */
0008 
0009 #ifndef PROJECTMODEL_H
0010 #define PROJECTMODEL_H
0011 
0012 #include <QAbstractItemModel>
0013 
0014 class ProjectModel : public QAbstractItemModel {
0015     Q_OBJECT
0016 public:
0017     explicit ProjectModel( QObject* parent = nullptr );
0018     ~ProjectModel() override;
0019 
0020     /*reimp*/ int rowCount( const QModelIndex& idx ) const override;
0021     /*reimp*/ int columnCount( const QModelIndex& idx ) const override;
0022 
0023     /*reimp*/ QModelIndex index( int row, int col, const QModelIndex& parent = QModelIndex() ) const override;
0024     /*reimp*/ QModelIndex parent( const QModelIndex& idx ) const override;
0025 
0026     /*reimp*/QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const override;
0027     /*reimp*/ QVariant data( const QModelIndex& idx, int role = Qt::DisplayRole ) const override;
0028     /*reimp*/ bool setData( const QModelIndex& idx,  const QVariant& value,
0029                             int role = Qt::DisplayRole ) override;
0030 
0031     /*reimp*/ bool insertRows( int row, int count, const QModelIndex& parent = QModelIndex() ) override;
0032     /*reimp*/ bool removeRows( int row, int count, const QModelIndex& parent = QModelIndex() ) override;
0033 
0034     /*reimp*/ Qt::ItemFlags flags( const QModelIndex& ) const override;
0035 
0036     bool load( const QString& filename );
0037     bool save( const QString& filename );
0038 
0039 private:
0040     class Node;
0041 
0042     Node* m_root;
0043 };
0044 
0045 #endif /* PROJECTMODEL_H */
0046