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 -------------------------------------------------------------------------*/
35 #ifndef vtkQtTreeView_h
36 #define vtkQtTreeView_h
37 
38 #include "vtkViewsQtModule.h" // For export macro
39 #include "vtkQtView.h"
40 
41 #include <QList> // Needed for member variables
42 #include <QPointer> // Needed for member variables
43 #include "vtkSmartPointer.h" // Needed for member variables
44 
45 class QAbstractItemDelegate;
46 class QAbstractItemView;
48 class QColumnView;
49 class QItemSelection;
50 class QModelIndex;
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 
77  virtual QWidget* GetWidget();
78 
82  void SetShowHeaders(bool);
83 
88 
92  void SetEnableDragDrop(bool);
93 
97  void SetShowRootNode(bool);
98 
102  void HideColumn(int i);
103 
107  void ShowColumn(int i);
108 
113 
117  void SetFilterColumn(int i);
118 
122  void SetFilterRegExp(const QRegExp& pattern);
123 
128 
132  void Collapse( const QModelIndex & index );
133 
137  void CollapseAll();
138 
142  void Expand ( const QModelIndex & index );
143 
149  void ExpandAll ();
150 
154  void ExpandToDepth ( int depth );
155 
159  void ResizeColumnToContents ( int column );
160 
164  void SetUseColumnView(int state);
165 
169  virtual void Update();
170 
174  void SetItemDelegate(QAbstractItemDelegate* delegate);
175 
177 
180  void SetColorArrayName(const char* name);
181  const char* GetColorArrayName();
183 
185 
188  void SetColorByArray(bool vis);
190  vtkBooleanMacro(ColorByArray, bool);
192 
193  virtual void ApplyViewTheme(vtkViewTheme* theme);
194 
195 protected:
198 
201 
202 private slots:
203  void slotQtSelectionChanged(const QItemSelection&,const QItemSelection&);
204 
205 private:
206  void SetVTKSelection();
207  vtkMTimeType CurrentSelectionMTime;
208  vtkMTimeType LastInputMTime;
209 
210  vtkSetStringMacro(ColorArrayNameInternal);
211  vtkGetStringMacro(ColorArrayNameInternal);
212 
213  QPointer<QTreeView> TreeView;
214  QPointer<QColumnView> ColumnView;
215  QPointer<QWidget> Widget;
216  QPointer<QVBoxLayout> Layout;
217  QPointer<QItemSelectionModel> SelectionModel;
218  QList<int> HiddenColumns;
219  vtkQtTreeModelAdapter* TreeAdapter;
220  QAbstractItemView* View;
221  char* ColorArrayNameInternal;
222  QFilterTreeProxyModel* TreeFilter;
223 
225 
226  vtkQtTreeView(const vtkQtTreeView&) VTK_DELETE_FUNCTION;
227  void operator=(const vtkQtTreeView&) VTK_DELETE_FUNCTION;
228 
229 };
230 
231 #endif
vtkQtTreeView::GetColorArrayName
const char * GetColorArrayName()
vtkQtTreeView::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkQtTreeView::vtkQtTreeView
vtkQtTreeView()
vtkQtTreeView::collapsed
void collapsed(const QModelIndex &)
vtkQtTreeView::SetColorByArray
void SetColorByArray(bool vis)
Whether to color vertices.
vtkQtTreeView
A VTK view based on a Qt tree view.
Definition: vtkQtTreeView.h:58
vtkQtTreeView::Update
virtual void Update()
Updates the view.
vtkQtTreeView::SetEnableDragDrop
void SetEnableDragDrop(bool)
Have the view alternate its row colors (default is OFF)
vtkQtTreeView::SetUseColumnView
void SetUseColumnView(int state)
Set whether to use a QColumnView (QTreeView is the default)
vtkSmartPointer< vtkApplyColors >
vtkQtTreeView::ExpandToDepth
void ExpandToDepth(int depth)
Expands all expandable items to the given depth.
vtkApplyColors
apply colors to a data set.
Definition: vtkApplyColors.h:87
vtkQtTreeView::HideColumn
void HideColumn(int i)
Hide the column of the given index from being shown in the view.
vtkQtTreeView::SetShowHeaders
void SetShowHeaders(bool)
Have the view show/hide its column headers (default is ON)
vtkMTimeType
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248
vtkQtTreeView::RemoveRepresentationInternal
virtual void RemoveRepresentationInternal(vtkDataRepresentation *rep)
vtkViewTheme
Sets theme colors for a graphical view.
Definition: vtkViewTheme.h:49
vtkX3D::level
@ level
Definition: vtkX3D.h:395
vtkDataRepresentation
The superclass for all representations.
Definition: vtkDataRepresentation.h:70
vtkQtTreeView::ApplyViewTheme
virtual void ApplyViewTheme(vtkViewTheme *theme)
vtkQtTreeView::ResizeColumnToContents
void ResizeColumnToContents(int column)
Resizes the column given to the size of its contents.
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkSmartPointer.h
vtkQtTreeView::SetShowRootNode
void SetShowRootNode(bool)
Show the root node of the tree (default is OFF)
vtkGetStringMacro
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
vtkQtTreeView::ExpandAll
void ExpandAll()
Expands all expandable items.
vtkX3D::name
@ name
Definition: vtkX3D.h:219
vtkQtTreeView::SetItemDelegate
void SetItemDelegate(QAbstractItemDelegate *delegate)
Set item delegate to something custom.
vtkQtTreeView::SetFilterColumn
void SetFilterColumn(int i)
The column used to filter on.
vtkQtTreeView::SetAlternatingRowColors
void SetAlternatingRowColors(bool)
Have the view alternate its row colors (default is OFF)
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkQtView.h
vtkQtTreeView::GetWidget
virtual QWidget * GetWidget()
Get the main container of this view (a QWidget).
vtkQtTreeView::~vtkQtTreeView
~vtkQtTreeView()
vtkQtTreeView::ShowColumn
void ShowColumn(int i)
Show the column of the given index in the view.
vtkQtTreeView::AddRepresentationInternal
virtual void AddRepresentationInternal(vtkDataRepresentation *rep)
vtkQtTreeView::GetColorByArray
bool GetColorByArray()
vtkQtTreeView::SetFilterRegExp
void SetFilterRegExp(const QRegExp &pattern)
The column used to filter on.
vtkQtTreeView::CollapseAll
void CollapseAll()
Collapses all expanded items.
vtkQtTreeView::SetColorArrayName
void SetColorArrayName(const char *name)
The array to use for coloring items in view.
vtkQtTreeView::HideAllButFirstColumn
void HideAllButFirstColumn()
Hide all but the first column in the view.
vtkQtView
Superclass for Qt widget-based views.
Definition: vtkQtView.h:32
vtkQtTreeView::Collapse
void Collapse(const QModelIndex &index)
Collapses the model item specified by the index.
vtkQtTreeView::New
static vtkQtTreeView * New()
vtkQtTreeView::expanded
void expanded(const QModelIndex &)
vtkX3D::index
@ index
Definition: vtkX3D.h:246
vtkQtTreeView::Expand
void Expand(const QModelIndex &index)
Expands the model item specified by the index.
vtkQtTreeView::updatePreviewWidget
void updatePreviewWidget(const QModelIndex &)
vtkQtTreeView::SetFilterTreeLevel
void SetFilterTreeLevel(int level)
The column used to filter on.
vtkQtTreeModelAdapter
Adapts a tree to a Qt item model.
Definition: vtkQtTreeModelAdapter.h:52
QFilterTreeProxyModel
Definition: QFilterTreeProxyModel.h:42