File indexing completed on 2024-04-28 04:37:05

0001 /*
0002     SPDX-FileCopyrightText: 2008 Aleix Pol <aleixpol@gmail.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef KDEVPLATFORM_PROJECTPROXYMODEL_H
0008 #define KDEVPLATFORM_PROJECTPROXYMODEL_H
0009 
0010 #include <QSortFilterProxyModel>
0011 #include "projectexport.h"
0012 
0013 namespace KDevelop {
0014     class ProjectModel;
0015     class ProjectBaseItem;
0016 }
0017 
0018 class KDEVPLATFORMPROJECT_EXPORT ProjectProxyModel : public QSortFilterProxyModel
0019 {
0020     Q_OBJECT
0021     public:
0022         explicit ProjectProxyModel(QObject *parent);
0023         bool lessThan (const QModelIndex & left, const QModelIndex & right) const override;
0024 
0025         QModelIndex proxyIndexFromItem(KDevelop::ProjectBaseItem* item) const;
0026         KDevelop::ProjectBaseItem* itemFromProxyIndex(const QModelIndex&) const;
0027 
0028         void showTargets(bool visible);
0029 
0030     protected:
0031         bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
0032 
0033     private:
0034         KDevelop::ProjectModel* projectModel() const;
0035         bool m_showTargets;
0036 
0037 };
0038 
0039 #endif