File indexing completed on 2024-06-23 04:17:57
0001 /** 0002 * SPDX-FileCopyrightText: 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved. 0003 * 0004 * This file is part of the KD Chart library. 0005 * 0006 * SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 0009 #ifndef TIMECHARTMODEL_H 0010 #define TIMECHARTMODEL_H 0011 0012 #include <QDateTime> 0013 #include <QSortFilterProxyModel> 0014 #include <QPair> 0015 0016 class TimeChartModel : public QSortFilterProxyModel 0017 { 0018 Q_OBJECT 0019 public: 0020 explicit TimeChartModel( QObject* parent = nullptr ); 0021 0022 QPair< QDateTime, QDateTime > visibleRange() const; 0023 0024 QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const override; 0025 0026 public Q_SLOTS: 0027 void setVisibleRange( const QDateTime& start, const QDateTime& end ); 0028 void setVisibleStart( const QDateTime& start ); 0029 void setVisibleEnd( const QDateTime& end ); 0030 0031 protected: 0032 bool filterAcceptsRow( int source_row, const QModelIndex& source_parent ) const override; 0033 0034 private: 0035 QPair< QDateTime, QDateTime > range; 0036 }; 0037 0038 #endif