Stellarium 0.14.3
SatellitesListFilterModel.hpp
1 /*
2  * Copyright (C) 2013 Bogdan Marinov
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18 
19 #ifndef SATELLITESLISTFILTERMODEL_HPP
20 #define SATELLITESLISTFILTERMODEL_HPP
21 
22 #include <QSortFilterProxyModel>
23 
24 #include "Satellite.hpp" // for the flags
25 
28 class SatellitesListFilterModel : public QSortFilterProxyModel
29 {
30  Q_OBJECT
31 
36  Q_PROPERTY(SatFlag filterFlag
37  READ getFilterFlag
38  WRITE setFilterFlag)
39 
40 
41  Q_PROPERTY(QString filterGroup
45  READ getFilterGroup
46  WRITE setFilterGroup)
47 
48 public:
49  SatellitesListFilterModel(QObject *parent = 0);
50 
51  SatFlag getFilterFlag() const { return filterFlag; }
52  void setFilterFlag(const SatFlag& flag);
53 
54  QString getFilterGroup() const { return filterGroup; }
55  void setFilterGroup(const QString& groupId);
56 
57  void setSecondaryFilters(const QString& groupId,
58  const SatFlag& flag);
59 
60 signals:
61 
62 public slots:
63 
64 protected:
66  bool filterAcceptsRow(int source_row,
67  const QModelIndex& source_parent) const;
68 
69 private:
70  SatFlag filterFlag;
71  QString filterGroup;
72 };
73 
74 #endif // SATELLITESLISTFILTERMODEL_HPP
SatFlag
Flag type reflecting internal flags of Satellite.
Definition: Satellite.hpp:66
Custom proxy model allowing filtering by satellite group and flag.
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
Reimplementation of the filtering method.