SCIRun  5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TreeViewCollaborators.h
Go to the documentation of this file.
1 /*
2  For more information, please see: http://software.sci.utah.edu
3 
4  The MIT License
5 
6  Copyright (c) 2012 Scientific Computing and Imaging Institute,
7  University of Utah.
8 
9  License for the specific language governing rights and limitations under
10  Permission is hereby granted, free of charge, to any person obtaining a
11  copy of this software and associated documentation files (the "Software"),
12  to deal in the Software without restriction, including without limitation
13  the rights to use, copy, modify, merge, publish, distribute, sublicense,
14  and/or sell copies of the Software, and to permit persons to whom the
15  Software is furnished to do so, subject to the following conditions:
16 
17  The above copyright notice and this permission notice shall be included
18  in all copies or substantial portions of the Software.
19 
20  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26  DEALINGS IN THE SOFTWARE.
27 */
28 
29 #ifndef INTERFACE_APPLICATION_TREEVIEWCOLLABORATORS_H
30 #define INTERFACE_APPLICATION_TREEVIEWCOLLABORATORS_H
31 
32 #include <QtGui>
33 
34 namespace SCIRun {
35 namespace Gui {
36 
38  {
39  QStringList nameList_;
40  void operator()(QTreeWidgetItem* item);
41  };
42 
43  template <class Func>
44  void visitItem(QTreeWidgetItem* item, Func& itemFunc)
45  {
46  itemFunc(item);
47  for (int i = 0; i < item->childCount(); ++i)
48  visitItem(item->child(i), itemFunc);
49  }
50 
51  template <class Func>
52  void visitTree(QTreeWidget* tree, Func& itemFunc)
53  {
54  for (int i = 0; i < tree->topLevelItemCount(); ++i)
55  visitItem(tree->topLevelItem(i), itemFunc);
56  }
57 
59  {
60  explicit HideItemsNotMatchingString(bool useRegex, const QString& pattern);
61  QRegExp match_;
62  QString start_;
63  bool useRegex_;
64 
65  void operator()(QTreeWidgetItem* item);
66  bool shouldHide(QTreeWidgetItem* item);
67  };
68 
69  struct ShowAll
70  {
71  void operator()(QTreeWidgetItem* item);
72  };
73 
74 }
75 }
76 #endif
QRegExp match_
Definition: TreeViewCollaborators.h:61
void visitItem(QTreeWidgetItem *item, Func &itemFunc)
Definition: TreeViewCollaborators.h:44
QString start_
Definition: TreeViewCollaborators.h:62
Definition: TreeViewCollaborators.h:58
Definition: TreeViewCollaborators.h:37
bool useRegex_
Definition: TreeViewCollaborators.h:63
void operator()(QTreeWidgetItem *item)
Definition: TreeViewCollaborators.cc:33
void operator()(QTreeWidgetItem *item)
Definition: TreeViewCollaborators.cc:42
QStringList nameList_
Definition: TreeViewCollaborators.h:39
HideItemsNotMatchingString(bool useRegex, const QString &pattern)
Definition: TreeViewCollaborators.cc:40
bool shouldHide(QTreeWidgetItem *item)
Definition: TreeViewCollaborators.cc:67
Definition: TreeViewCollaborators.h:69
void visitTree(QTreeWidget *tree, Func &itemFunc)
Definition: TreeViewCollaborators.h:52
void operator()(QTreeWidgetItem *item)
Definition: TreeViewCollaborators.cc:75