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 
29 namespace armarx
30 {
31  class InfixFilterModel;
32 }
33 
34 class QStandardItem;
35 class QLineEdit;
36 
37 /**
38  * \brief The FilterableTreeView class
39  */
40 class FilterableTreeView : public QTreeView
41 {
42  Q_OBJECT
43 public:
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 
54 private:
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
64 public:
65  void setModel(QAbstractItemModel* model) override;
67 
68 protected slots:
69  void expandFilterSelection(QString filterStr);
71 };
FilterableTreeView::delayedFilterExpansion
void delayedFilterExpansion()
Definition: FilterableTreeView.cpp:96
FilterableTreeView::FilterableTreeView
FilterableTreeView(QWidget *parent=0, bool hideChildren=true)
Definition: FilterableTreeView.cpp:38
FilterableTreeView::setModel
void setModel(QAbstractItemModel *model) override
Definition: FilterableTreeView.cpp:63
FilterableTreeView::DefaultFilterStr
static const QString DefaultFilterStr
Definition: FilterableTreeView.h:52
FilterableTreeView::expandFilterSelection
void expandFilterSelection(QString filterStr)
Definition: FilterableTreeView.cpp:81
FilterableTreeView::setHideChildren
void setHideChildren(bool hideChildren)
Definition: FilterableTreeView.h:47
armarx::InfixFilterModel
This proxy model reimplements the filterAcceptsRow function with a new behavior: All elements that fi...
Definition: InfixFilterModel.h:42
FilterableTreeView
The FilterableTreeView class.
Definition: FilterableTreeView.h:40
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
FilterableTreeView::getProxyModel
armarx::InfixFilterModel * getProxyModel() const
Definition: FilterableTreeView.cpp:57