VTK
vtkQtTreeView.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkQtTreeView.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 /*-------------------------------------------------------------------------
16  Copyright 2008 Sandia Corporation.
17  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
18  the U.S. Government retains certain rights in this software.
19 -------------------------------------------------------------------------*/
34 #ifndef vtkQtTreeView_h
35 #define vtkQtTreeView_h
36 
37 #include "vtkViewsQtModule.h" // For export macro
38 #include "vtkQtView.h"
39 
40 #include <QList> // Needed for member variables
41 #include <QPointer> // Needed for member variables
42 #include "vtkSmartPointer.h" // Needed for member variables
43 
44 class QAbstractItemDelegate;
45 class QAbstractItemView;
46 class QFilterTreeProxyModel;
47 class QColumnView;
48 class QItemSelection;
49 class QModelIndex;
50 class QTreeView;
51 class vtkApplyColors;
52 class QVBoxLayout;
54 class QItemSelectionModel;
55 
57 {
58 Q_OBJECT
59 
60 signals:
61  void expanded(const QModelIndex&);
62  void collapsed(const QModelIndex&);
63  void updatePreviewWidget(const QModelIndex&);
64 
65 public:
66  static vtkQtTreeView *New();
67  vtkTypeMacro(vtkQtTreeView, vtkQtView);
68  void PrintSelf(ostream& os, vtkIndent indent);
69 
73  virtual QWidget* GetWidget();
74 
76  void SetShowHeaders(bool);
77 
79  void SetAlternatingRowColors(bool);
80 
82  void SetEnableDragDrop(bool);
83 
85  void SetShowRootNode(bool);
86 
88  void HideColumn(int i);
89 
91  void ShowColumn(int i);
92 
94  void HideAllButFirstColumn();
95 
97  void SetFilterColumn(int i);
98 
100  void SetFilterRegExp(const QRegExp& pattern);
101 
103  void SetFilterTreeLevel(int level);
104 
106  void Collapse( const QModelIndex & index );
107 
109  void CollapseAll();
110 
112  void Expand ( const QModelIndex & index );
113 
116  void ExpandAll ();
117 
119  void ExpandToDepth ( int depth );
120 
122  void ResizeColumnToContents ( int column );
123 
125  void SetUseColumnView(int state);
126 
128  virtual void Update();
129 
131  void SetItemDelegate(QAbstractItemDelegate* delegate);
132 
134 
135  void SetColorArrayName(const char* name);
136  const char* GetColorArrayName();
138 
140 
141  void SetColorByArray(bool vis);
142  bool GetColorByArray();
143  vtkBooleanMacro(ColorByArray, bool);
145 
146  virtual void ApplyViewTheme(vtkViewTheme* theme);
147 
148 protected:
149  vtkQtTreeView();
150  ~vtkQtTreeView();
151 
154 
155 private slots:
156  void slotQtSelectionChanged(const QItemSelection&,const QItemSelection&);
157 
158 private:
159  void SetVTKSelection();
160  unsigned long CurrentSelectionMTime;
161  unsigned long LastInputMTime;
162 
163  vtkSetStringMacro(ColorArrayNameInternal);
164  vtkGetStringMacro(ColorArrayNameInternal);
165 
166  QPointer<QTreeView> TreeView;
167  QPointer<QColumnView> ColumnView;
168  QPointer<QWidget> Widget;
169  QPointer<QVBoxLayout> Layout;
170  QPointer<QItemSelectionModel> SelectionModel;
171  QList<int> HiddenColumns;
172  vtkQtTreeModelAdapter* TreeAdapter;
173  QAbstractItemView* View;
174  char* ColorArrayNameInternal;
175  QFilterTreeProxyModel* TreeFilter;
176 
178 
179  vtkQtTreeView(const vtkQtTreeView&); // Not implemented.
180  void operator=(const vtkQtTreeView&); // Not implemented.
181 
182 };
183 
184 #endif
virtual void ApplyViewTheme(vtkViewTheme *vtkNotUsed(theme))
Definition: vtkView.h:125
static vtkView * New()
Adapts a tree to a Qt item model.
virtual void Update()
virtual QWidget * GetWidget()=0
#define VTKVIEWSQT_EXPORT
virtual void AddRepresentationInternal(vtkDataRepresentation *vtkNotUsed(rep))
Definition: vtkView.h:203
Sets theme colors for a graphical view.
Definition: vtkViewTheme.h:47
a simple class to control print indentation
Definition: vtkIndent.h:38
void PrintSelf(ostream &os, vtkIndent indent)
The superclass for all representations.
apply colors to a data set.
Superclass for Qt widget-based views.
Definition: vtkQtView.h:30
virtual void RemoveRepresentationInternal(vtkDataRepresentation *vtkNotUsed(rep))
Definition: vtkView.h:204
A VTK view based on a Qt tree view.
Definition: vtkQtTreeView.h:56