1 /* 2 * Copyright (C) 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved. 3 * 4 * This file is part of the KGantt library. 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License as 8 * published by the Free Software Foundation; either version 2 of 9 * the License, or (at your option) any later version. 10 * 11 * This program 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 this program. If not, see <https://www.gnu.org/licenses/>. 18 */ 19 20 #ifndef KGANTTSUMMARYHANDLINGPROXYMODEL_H 21 #define KGANTTSUMMARYHANDLINGPROXYMODEL_H 22 23 #include "kganttforwardingproxymodel.h" 24 25 namespace KGantt { 26 27 28 /*!\class KGantt::SummaryHandlingProxyModel 29 * \brief Proxy model that supports summary gantt items. 30 * 31 * This proxy model provides the functionality of summary items. 32 * A summary item is an item with type KGantt::TypeSummary and 33 * zero or more children in the model that it summarizes. 34 * GraphicsView itself does not dictate any policy for summary items, 35 * instead the logic for making the summary items start and end points 36 * span it's children is provided by this proxy. 37 * 38 * The start and end times of a summary is the min/max of the 39 * start/end times of it's children. 40 * 41 * \see GraphicsView::setModel 42 */ 43 class KGANTT_EXPORT SummaryHandlingProxyModel : public ForwardingProxyModel { 44 Q_OBJECT 45 KGANTT_DECLARE_PRIVATE_BASE_POLYMORPHIC( SummaryHandlingProxyModel ) 46 public: 47 48 49 /*! Constructor. Creates a new SummaryHandlingProxyModel with 50 * parent \a parent 51 */ 52 explicit SummaryHandlingProxyModel( QObject* parent = nullptr ); 53 virtual ~SummaryHandlingProxyModel(); 54 55 56 57 /*! Sets the model to be used as the source model for this proxy. 58 * The proxy does not take ownership of the model. 59 * \see QAbstractProxyModel::setSourceModel 60 */ 61 /*reimp*/ void setSourceModel( QAbstractItemModel* model ) override; 62 63 64 65 /*! \see QAbstractItemModel::data */ 66 /*reimp*/ QVariant data( const QModelIndex& proxyIndex, int role = Qt::DisplayRole) const override; 67 68 69 /*! \see QAbstractItemModel::setData */ 70 /*reimp*/ bool setData( const QModelIndex& index, const QVariant& value, int role = Qt::EditRole ) override; 71 72 73 74 /*! \see QAbstractItemModel::flags */ 75 /*reimp*/ Qt::ItemFlags flags( const QModelIndex& idx ) const override; 76 77 protected: 78 /*reimp*/ void sourceModelReset() override; 79 /*reimp*/ void sourceLayoutChanged() override; 80 /*reimp*/ void sourceDataChanged( const QModelIndex& from, const QModelIndex& to ) override; 81 /*reimp*/ void sourceColumnsAboutToBeInserted( const QModelIndex& idx, int start, int end ) override; 82 /*reimp*/ void sourceColumnsAboutToBeRemoved( const QModelIndex& idx, int start, int end ) override; 83 /*reimp*/ void sourceRowsAboutToBeInserted( const QModelIndex& idx, int start, int end ) override; 84 /*reimp*/ void sourceRowsAboutToBeRemoved( const QModelIndex&, int start, int end ) override; 85 }; 86 } 87 88 #endif /* KGANTTSUMMARYHANDLINGPROXYMODEL_H */ 89 90