File indexing completed on 2024-05-12 04:20:45

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 KGANTTSUMMARYHANDLINGPROXYMODEL_H
0010 #define KGANTTSUMMARYHANDLINGPROXYMODEL_H
0011 
0012 #include "kganttforwardingproxymodel.h"
0013 
0014 namespace KGantt {
0015 
0016 
0017     /*!\class KGantt::SummaryHandlingProxyModel
0018      * \brief Proxy model that supports summary gantt items.
0019      *
0020      * This proxy model provides the functionality of summary items.
0021      * A summary item is an item with type KGantt::TypeSummary and
0022      * zero or more children in the model that it summarizes.
0023      * GraphicsView itself does not dictate any policy for summary items,
0024      * instead the logic for making the summary items start and end points
0025      * span it's children is provided by this proxy.
0026      *
0027      * The start and end times of a summary is the min/max of the
0028      * start/end times of it's children.
0029      *
0030      * \see GraphicsView::setModel
0031      */
0032     class KGANTT_EXPORT SummaryHandlingProxyModel : public ForwardingProxyModel {
0033         Q_OBJECT
0034         KGANTT_DECLARE_PRIVATE_BASE_POLYMORPHIC( SummaryHandlingProxyModel )
0035     public:
0036 
0037 
0038         /*! Constructor. Creates a new SummaryHandlingProxyModel with
0039          * parent \a parent
0040          */
0041         explicit SummaryHandlingProxyModel( QObject* parent = nullptr );
0042         ~SummaryHandlingProxyModel() override;
0043 
0044 
0045 
0046         /*! Sets the model to be used as the source model for this proxy.
0047          * The proxy does not take ownership of the model.
0048          * \see QAbstractProxyModel::setSourceModel
0049          */
0050         /*reimp*/ void setSourceModel( QAbstractItemModel* model ) override;
0051 
0052 
0053 
0054         /*! \see QAbstractItemModel::data */
0055         /*reimp*/ QVariant data( const QModelIndex& proxyIndex, int role = Qt::DisplayRole) const override;
0056 
0057 
0058         /*! \see QAbstractItemModel::setData */
0059         /*reimp*/ bool setData( const QModelIndex& index, const QVariant& value, int role = Qt::EditRole ) override;
0060 
0061 
0062 
0063         /*! \see QAbstractItemModel::flags */
0064         /*reimp*/ Qt::ItemFlags flags( const QModelIndex& idx ) const override;
0065 
0066     protected:
0067         /*reimp*/ void sourceModelReset() override;
0068         /*reimp*/ void sourceLayoutChanged() override;
0069         /*reimp*/ void sourceDataChanged( const QModelIndex& from, const QModelIndex& to ) override;
0070         /*reimp*/ void sourceColumnsAboutToBeInserted( const QModelIndex& idx, int start, int end ) override;
0071         /*reimp*/ void sourceColumnsAboutToBeRemoved( const QModelIndex& idx, int start, int end ) override;
0072         /*reimp*/ void sourceRowsAboutToBeInserted( const QModelIndex& idx, int start, int end ) override;
0073         /*reimp*/ void sourceRowsAboutToBeRemoved( const QModelIndex&, int start, int end ) override;
0074     };
0075 }
0076 
0077 #endif /* KGANTTSUMMARYHANDLINGPROXYMODEL_H */
0078