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
45class QAbstractItemDelegate;
46class QAbstractItemView;
48class QColumnView;
49class QItemSelection;
50class QModelIndex;
51class QTreeView;
52class vtkApplyColors;
53class QVBoxLayout;
55class QItemSelectionModel;
56
57class VTKVIEWSQT_EXPORT vtkQtTreeView : public vtkQtView
58{
59Q_OBJECT
60
61signals:
62 void expanded(const QModelIndex&);
63 void collapsed(const QModelIndex&);
64 void updatePreviewWidget(const QModelIndex&);
65
66public:
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
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
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
195protected:
198
201
202private slots:
203 void slotQtSelectionChanged(const QItemSelection&,const QItemSelection&);
204
205private:
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
apply colors to a data set.
The superclass for all representations.
a simple class to control print indentation
Definition: vtkIndent.h:40
Adapts a tree to a Qt item model.
A VTK view based on a Qt tree view.
Definition: vtkQtTreeView.h:58
static vtkQtTreeView * New()
void SetFilterTreeLevel(int level)
The column used to filter on.
void SetShowRootNode(bool)
Show the root node of the tree (default is OFF)
void SetColorByArray(bool vis)
Whether to color vertices.
virtual void ApplyViewTheme(vtkViewTheme *theme)
void SetUseColumnView(int state)
Set whether to use a QColumnView (QTreeView is the default)
void ExpandToDepth(int depth)
Expands all expandable items to the given depth.
void SetColorArrayName(const char *name)
The array to use for coloring items in view.
void Collapse(const QModelIndex &index)
Collapses the model item specified by the index.
void SetFilterColumn(int i)
The column used to filter on.
virtual void RemoveRepresentationInternal(vtkDataRepresentation *rep)
bool GetColorByArray()
const char * GetColorArrayName()
void updatePreviewWidget(const QModelIndex &)
virtual QWidget * GetWidget()
Get the main container of this view (a QWidget).
void CollapseAll()
Collapses all expanded items.
void HideAllButFirstColumn()
Hide all but the first column in the view.
void Expand(const QModelIndex &index)
Expands the model item specified by the index.
void collapsed(const QModelIndex &)
void SetEnableDragDrop(bool)
Have the view alternate its row colors (default is OFF)
virtual void AddRepresentationInternal(vtkDataRepresentation *rep)
void ResizeColumnToContents(int column)
Resizes the column given to the size of its contents.
void ShowColumn(int i)
Show the column of the given index in the view.
void SetShowHeaders(bool)
Have the view show/hide its column headers (default is ON)
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
void SetItemDelegate(QAbstractItemDelegate *delegate)
Set item delegate to something custom.
virtual void Update()
Updates the view.
void HideColumn(int i)
Hide the column of the given index from being shown in the view.
void SetAlternatingRowColors(bool)
Have the view alternate its row colors (default is OFF)
void ExpandAll()
Expands all expandable items.
void SetFilterRegExp(const QRegExp &pattern)
The column used to filter on.
void expanded(const QModelIndex &)
Superclass for Qt widget-based views.
Definition: vtkQtView.h:32
Sets theme colors for a graphical view.
Definition: vtkViewTheme.h:49
@ level
Definition: vtkX3D.h:395
@ name
Definition: vtkX3D.h:219
@ index
Definition: vtkX3D.h:246
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248