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 namespace armarx
29 {
30  class InfixFilterModel;
31 }
32 
33 class QStandardItem;
34 class QLineEdit;
35 
36 /**
37  * \brief The FilterableTreeView class
38  */
39 class FilterableTreeView : public QTreeView
40 {
41  Q_OBJECT
42 public:
43  explicit FilterableTreeView(QWidget* parent = 0, bool hideChildren = true);
44  void setHideChildren(bool hideChildren)
45  {
46  this->hideChildren = hideChildren;
47  }
48  static const QString DefaultFilterStr;
49 
50 private:
51  void resizeEvent(QResizeEvent* event) override;
52 
53 
54  bool hideChildren;
55  QLineEdit* filterLineEdit;
56  armarx::InfixFilterModel* proxyModel;
57  QTimer filterExpansionTimer;
58 
59  // QAbstractItemView interface
60 public:
61  void setModel(QAbstractItemModel* model) override;
63 
64 protected slots:
65  void expandFilterSelection(QString filterStr);
67 };
68 
69 
FilterableTreeView::delayedFilterExpansion
void delayedFilterExpansion()
Definition: FilterableTreeView.cpp:86
FilterableTreeView::FilterableTreeView
FilterableTreeView(QWidget *parent=0, bool hideChildren=true)
Definition: FilterableTreeView.cpp:36
FilterableTreeView::setModel
void setModel(QAbstractItemModel *model) override
Definition: FilterableTreeView.cpp:60
FilterableTreeView::DefaultFilterStr
static const QString DefaultFilterStr
Definition: FilterableTreeView.h:48
FilterableTreeView::expandFilterSelection
void expandFilterSelection(QString filterStr)
Definition: FilterableTreeView.cpp:72
FilterableTreeView::setHideChildren
void setHideChildren(bool hideChildren)
Definition: FilterableTreeView.h:44
armarx::InfixFilterModel
This proxy model reimplements the filterAcceptsRow function with a new behavior: All elements that fi...
Definition: InfixFilterModel.h:41
FilterableTreeView
The FilterableTreeView class.
Definition: FilterableTreeView.h:39
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
FilterableTreeView::getProxyModel
armarx::InfixFilterModel * getProxyModel() const
Definition: FilterableTreeView.cpp:55