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_P_H
0010 #define KGANTTSUMMARYHANDLINGPROXYMODEL_P_H
0011 
0012 #include "kganttsummaryhandlingproxymodel.h"
0013 
0014 #include <QDateTime>
0015 #include <QHash>
0016 #include <QPair>
0017 #include <QPersistentModelIndex>
0018 
0019 namespace KGantt {
0020     class Q_DECL_HIDDEN SummaryHandlingProxyModel::Private {
0021     public:
0022         bool cacheLookup( const QModelIndex& idx,
0023                           QPair<QDateTime,QDateTime>* result ) const;
0024         void insertInCache( const SummaryHandlingProxyModel* model, const QModelIndex& idx ) const;
0025         void removeFromCache( const QModelIndex& idx ) const;
0026         void clearCache() const;
0027         
0028         inline bool isSummary( const QModelIndex& idx ) const {
0029             int typ = idx.data( ItemTypeRole ).toInt();
0030             return (typ==TypeSummary) || (typ==TypeMulti);
0031         }
0032 
0033         mutable QHash<QModelIndex, QPair<QDateTime, QDateTime> > cached_summary_items;
0034     };
0035 }
0036 
0037 #endif /* KGANTTSUMMARYHANDLINGPROXYMODEL_P_H */
0038