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 
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();
69  void PrintSelf(ostream& os, vtkIndent indent);
70 
74  virtual QWidget* GetWidget();
75 
77  void SetShowHeaders(bool);
78 
81 
83  void SetEnableDragDrop(bool);
84 
86  void SetShowRootNode(bool);
87 
89  void HideColumn(int i);
90 
92  void ShowColumn(int i);
93 
96 
98  void SetFilterColumn(int i);
99 
101  void SetFilterRegExp(const QRegExp& pattern);
102 
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 
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);
144  vtkBooleanMacro(ColorByArray, bool);
146 
147  virtual void ApplyViewTheme(vtkViewTheme* theme);
148 
149 protected:
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
vtkQtTreeView::GetColorArrayName
const char * GetColorArrayName()
vtkQtTreeView::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkQtTreeView::vtkQtTreeView
vtkQtTreeView()
vtkQtTreeView::collapsed
void collapsed(const QModelIndex &)
vtkQtTreeView::SetColorByArray
void SetColorByArray(bool vis)
vtkQtTreeView
A VTK view based on a Qt tree view.
Definition: vtkQtTreeView.h:58
vtkQtTreeView::Update
virtual void Update()
vtkQtTreeView::SetEnableDragDrop
void SetEnableDragDrop(bool)
vtkQtTreeView::SetUseColumnView
void SetUseColumnView(int state)
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkSmartPointer< vtkApplyColors >
vtkQtTreeView::ExpandToDepth
void ExpandToDepth(int depth)
vtkApplyColors
apply colors to a data set.
Definition: vtkApplyColors.h:86
vtkQtTreeView::HideColumn
void HideColumn(int i)
vtkQtAbstractModelAdapter.h
vtkQtTreeView::SetShowHeaders
void SetShowHeaders(bool)
vtkQtTreeView::RemoveRepresentationInternal
virtual void RemoveRepresentationInternal(vtkDataRepresentation *rep)
vtkViewTheme
Sets theme colors for a graphical view.
Definition: vtkViewTheme.h:48
vtkgl::depth
GLint GLint GLsizei GLsizei GLsizei depth
Definition: vtkgl.h:11316
vtkgl::name
GLuint const GLchar * name
Definition: vtkgl.h:11983
vtkViewsQtModule.h
vtkDataRepresentation
The superclass for all representations.
Definition: vtkDataRepresentation.h:72
VTKVIEWSQT_EXPORT
#define VTKVIEWSQT_EXPORT
Definition: vtkViewsQtModule.h:15
vtkQtTreeView::ApplyViewTheme
virtual void ApplyViewTheme(vtkViewTheme *theme)
vtkgl::column
GLenum GLenum GLvoid GLvoid * column
Definition: vtkgl.h:11352
vtkQtTreeView::ResizeColumnToContents
void ResizeColumnToContents(int column)
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkSetStringMacro
#define vtkSetStringMacro(name)
Definition: vtkSetGet.h:104
vtkSmartPointer.h
vtkQtTreeView::SetShowRootNode
void SetShowRootNode(bool)
vtkgl::pattern
GLubyte * pattern
Definition: vtkgl.h:14438
vtkGetStringMacro
vtkGetStringMacro(ExtensionsString)
vtkQtTreeView::ExpandAll
void ExpandAll()
vtkgl::level
GLint level
Definition: vtkgl.h:11316
vtkQtTreeView::SetItemDelegate
void SetItemDelegate(QAbstractItemDelegate *delegate)
vtkQtTreeView::SetFilterColumn
void SetFilterColumn(int i)
vtkQtTreeView::SetAlternatingRowColors
void SetAlternatingRowColors(bool)
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
vtkgl::index
GLuint index
Definition: vtkgl.h:11983
vtkQtView.h
vtkQtTreeView::GetWidget
virtual QWidget * GetWidget()
vtkQtTreeView::~vtkQtTreeView
~vtkQtTreeView()
vtkQtTreeView::ShowColumn
void ShowColumn(int i)
vtkQtTreeView::AddRepresentationInternal
virtual void AddRepresentationInternal(vtkDataRepresentation *rep)
vtkQtTreeView::GetColorByArray
bool GetColorByArray()
vtkQtTreeView::SetFilterRegExp
void SetFilterRegExp(const QRegExp &pattern)
vtkQtTreeView::CollapseAll
void CollapseAll()
vtkQtTreeView::SetColorArrayName
void SetColorArrayName(const char *name)
vtkQtTreeView::HideAllButFirstColumn
void HideAllButFirstColumn()
vtkQtView
Superclass for Qt widget-based views.
Definition: vtkQtView.h:32
vtkQtTreeView::Collapse
void Collapse(const QModelIndex &index)
vtkQtTreeView::New
static vtkQtTreeView * New()
vtkQtTreeView::expanded
void expanded(const QModelIndex &)
vtkQtTreeView::Expand
void Expand(const QModelIndex &index)
vtkQtTreeView::updatePreviewWidget
void updatePreviewWidget(const QModelIndex &)
vtkQtTreeView::SetFilterTreeLevel
void SetFilterTreeLevel(int level)
vtkQtTreeModelAdapter
Adapts a tree to a Qt item model.
Definition: vtkQtTreeModelAdapter.h:51