File indexing completed on 2024-05-19 05:44:26

0001 /*
0002     SPDX-FileCopyrightText: 2016-2017 Milian Wolff <mail@milianw.de>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-or-later
0005 */
0006 
0007 #ifndef TOPPROXY_H
0008 #define TOPPROXY_H
0009 
0010 #include <QSortFilterProxyModel>
0011 
0012 #include "treemodel.h"
0013 
0014 class TopProxy : public QSortFilterProxyModel
0015 {
0016     Q_OBJECT
0017 public:
0018     enum Type
0019     {
0020         Peak,
0021         Leaked,
0022         Allocations,
0023         Temporary
0024     };
0025 
0026     explicit TopProxy(Type type, QObject* parent = nullptr);
0027     ~TopProxy() override;
0028 
0029     bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override;
0030     bool filterAcceptsColumn(int source_column, const QModelIndex& source_parent) const override;
0031     void setSourceModel(QAbstractItemModel* sourceModel) override;
0032 
0033 private:
0034     void updateCostThreshold();
0035 
0036     Type m_type;
0037     qint64 m_costThreshold = 0;
0038 };
0039 
0040 #endif // TOPPROXY_H