FilterableTreeView.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
19 * @author
20 * @date
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24#pragma once
25
26#include <QTimer>
27#include <QTreeView>
28
29namespace armarx
30{
31 class InfixFilterModel;
32}
33
34class QStandardItem;
35class QLineEdit;
36
37/**
38 * \brief The FilterableTreeView class
39 */
40class FilterableTreeView : public QTreeView
41{
42 Q_OBJECT
43public:
44 explicit FilterableTreeView(QWidget* parent = 0, bool hideChildren = true);
45
46 void
47 setHideChildren(bool hideChildren)
48 {
49 this->hideChildren = hideChildren;
50 }
51
52 static const QString DefaultFilterStr;
53
54private:
55 void resizeEvent(QResizeEvent* event) override;
56
57
58 bool hideChildren;
59 QLineEdit* filterLineEdit;
60 armarx::InfixFilterModel* proxyModel;
61 QTimer filterExpansionTimer;
62
63 // QAbstractItemView interface
64public:
65 void setModel(QAbstractItemModel* model) override;
67
68protected slots:
69 void expandFilterSelection(QString filterStr);
71};
FilterableTreeView(QWidget *parent=0, bool hideChildren=true)
void setModel(QAbstractItemModel *model) override
static const QString DefaultFilterStr
void expandFilterSelection(QString filterStr)
armarx::InfixFilterModel * getProxyModel() const
void setHideChildren(bool hideChildren)
This proxy model reimplements the filterAcceptsRow function with a new behavior: All elements that fi...
This file offers overloads of toIce() and fromIce() functions for STL container types.