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 "QVTKWin32Header.h"
39 #include "vtkQtView.h"
40 
41 #include <QList>
42 #include <QPointer>
44 #include "vtkSmartPointer.h"
45 #include "QFilterTreeProxyModel.h"
46 
47 class QAbstractItemDelegate;
48 class QAbstractItemView;
49 class QColumnView;
50 class QItemSelection;
51 class QTreeView;
52 class vtkApplyColors;
53 class QVBoxLayout;
55 class QItemSelectionModel;
56 
57 class VTKVIEWSQT_EXPORT vtkQtTreeView : public vtkQtView
58 {
59 Q_OBJECT
60 
61 signals:
62  void expanded(const QModelIndex&);
63  void collapsed(const QModelIndex&);
64  void updatePreviewWidget(const QModelIndex&);
65 
66 public:
67  static vtkQtTreeView *New();
68  vtkTypeMacro(vtkQtTreeView, vtkQtView);
69  void PrintSelf(ostream& os, vtkIndent indent);
70 
74  virtual QWidget* GetWidget();
75 
77  void SetShowHeaders(bool);
78 
80  void SetAlternatingRowColors(bool);
81 
83  void SetEnableDragDrop(bool);
84 
86  void SetShowRootNode(bool);
87 
89  void HideColumn(int i);
90 
92  void ShowColumn(int i);
93 
95  void HideAllButFirstColumn();
96 
98  void SetFilterColumn(int i);
99 
101  void SetFilterRegExp(const QRegExp& pattern);
102 
104  void SetFilterTreeLevel(int level);
105 
107  void Collapse( const QModelIndex & index );
108 
110  void CollapseAll();
111 
113  void Expand ( const QModelIndex & index );
114 
117  void ExpandAll ();
118 
120  void ExpandToDepth ( int depth );
121 
123  void ResizeColumnToContents ( int column );
124 
126  void SetUseColumnView(int state);
127 
129  virtual void Update();
130 
132  void SetItemDelegate(QAbstractItemDelegate* delegate);
133 
135 
136  void SetColorArrayName(const char* name);
137  const char* GetColorArrayName();
139 
141 
142  void SetColorByArray(bool vis);
143  bool GetColorByArray();
144  vtkBooleanMacro(ColorByArray, bool);
146 
147  virtual void ApplyViewTheme(vtkViewTheme* theme);
148 
149 protected:
150  vtkQtTreeView();
151  ~vtkQtTreeView();
152 
155 
156 private slots:
157  void slotQtSelectionChanged(const QItemSelection&,const QItemSelection&);
158 
159 private:
160  void SetVTKSelection();
161  unsigned long CurrentSelectionMTime;
162  unsigned long LastInputMTime;
163 
164  vtkSetStringMacro(ColorArrayNameInternal);
165  vtkGetStringMacro(ColorArrayNameInternal);
166 
167  QPointer<QTreeView> TreeView;
168  QPointer<QColumnView> ColumnView;
169  QPointer<QWidget> Widget;
170  QPointer<QVBoxLayout> Layout;
171  QPointer<QItemSelectionModel> SelectionModel;
172  QList<int> HiddenColumns;
173  vtkQtTreeModelAdapter* TreeAdapter;
174  QAbstractItemView* View;
175  char* ColorArrayNameInternal;
176  QFilterTreeProxyModel* TreeFilter;
177 
179 
180  vtkQtTreeView(const vtkQtTreeView&); // Not implemented.
181  void operator=(const vtkQtTreeView&); // Not implemented.
182 
183 };
184 
185 #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
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:31
virtual void RemoveRepresentationInternal(vtkDataRepresentation *vtkNotUsed(rep))
Definition: vtkView.h:204
A VTK view based on a Qt tree view.
Definition: vtkQtTreeView.h:57