filterabletreemodelsortfilterproxymodel.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package ArmarXCore::core
19  * @author Cedric Seehausen (usdnr at kit dot edu)
20  * @date 2016
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 
25 
26 #pragma once
27 
28 #include "scenarioitem.h"
30 #include "openscenarioitem.h"
31 #include "settingsitem.h"
32 #include <QSortFilterProxyModel>
33 #include <QModelIndex>
34 #include <qmetatype.h>
35 #include <memory>
36 
37 /**
38 * @class FilterableTreeModelSortFilterProxyModel
39 * @brief Model of the FilterableTreeView.
40 */
41 class FilterableTreeModelSortFilterProxyModel : public QSortFilterProxyModel
42 {
43  Q_OBJECT
44 public:
45  /**
46  * Constructor that registers the used meta-types.
47  */
49 
50  /**
51  * Returns the data stored at the specified location, based on the given role.
52  * @param proxy_index Model-Index of the item
53  * @param role describes what kind of data is requested
54  */
55  QVariant data(const QModelIndex& proxy_index, int role) const override;
56 
57  /**
58  * Returns whether the filter accepts a row.
59  * @param sourceRow index of the row
60  * @param sourceParent index of the parent
61  */
62  bool filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const override;
63 };
64 
65 using FilterableTreeModelSortFilterProxyModelPtr = std::shared_ptr<FilterableTreeModelSortFilterProxyModel>;
settingsitem.h
FilterableTreeModelSortFilterProxyModel::filterAcceptsRow
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override
Returns whether the filter accepts a row.
Definition: filterabletreemodelsortfilterproxymodel.cpp:68
scenarioitem.h
FilterableTreeModelSortFilterProxyModel::FilterableTreeModelSortFilterProxyModel
FilterableTreeModelSortFilterProxyModel()
Constructor that registers the used meta-types.
Definition: filterabletreemodelsortfilterproxymodel.cpp:34
FilterableTreeModelSortFilterProxyModelPtr
std::shared_ptr< FilterableTreeModelSortFilterProxyModel > FilterableTreeModelSortFilterProxyModelPtr
Definition: filterabletreemodelsortfilterproxymodel.h:65
FilterableTreeModelSortFilterProxyModel
Model of the FilterableTreeView.
Definition: filterabletreemodelsortfilterproxymodel.h:41
openscenarioitem.h
FilterableTreeModelSortFilterProxyModel::data
QVariant data(const QModelIndex &proxy_index, int role) const override
Returns the data stored at the specified location, based on the given role.
Definition: filterabletreemodelsortfilterproxymodel.cpp:42
applicationdatabaseitem.h