00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00031 #ifndef __vtkQtTreeView_h
00032 #define __vtkQtTreeView_h
00033
00034 #include "QVTKWin32Header.h"
00035 #include "vtkQtView.h"
00036
00037 #include <QList>
00038 #include <QPointer>
00039 #include "vtkQtAbstractModelAdapter.h"
00040 #include "vtkSmartPointer.h"
00041 #include "QFilterTreeProxyModel.h"
00042
00043 class QAbstractItemDelegate;
00044 class QAbstractItemView;
00045 class QColumnView;
00046 class QItemSelection;
00047 class QTreeView;
00048 class vtkApplyColors;
00049 class QVBoxLayout;
00050 class vtkQtTreeModelAdapter;
00051 class QItemSelectionModel;
00052
00053 class QVTK_EXPORT vtkQtTreeView : public vtkQtView
00054 {
00055 Q_OBJECT
00056
00057 signals:
00058 void expanded(const QModelIndex&);
00059 void collapsed(const QModelIndex&);
00060 void updatePreviewWidget(const QModelIndex&);
00061
00062 public:
00063 static vtkQtTreeView *New();
00064 vtkTypeRevisionMacro(vtkQtTreeView, vtkQtView);
00065 void PrintSelf(ostream& os, vtkIndent indent);
00066
00070 virtual QWidget* GetWidget();
00071
00073 void SetShowHeaders(bool);
00074
00076 void SetAlternatingRowColors(bool);
00077
00079 void SetEnableDragDrop(bool);
00080
00082 void SetShowRootNode(bool);
00083
00085 void HideColumn(int i);
00086
00088 void ShowColumn(int i);
00089
00091 void HideAllButFirstColumn();
00092
00094 void SetFilterColumn(int i);
00095
00097 void SetFilterRegExp(const QRegExp& pattern);
00098
00100 void SetFilterTreeLevel(int level);
00101
00103 void Collapse( const QModelIndex & index );
00104
00106 void CollapseAll();
00107
00109 void Expand ( const QModelIndex & index );
00110
00113 void ExpandAll ();
00114
00116 void ExpandToDepth ( int depth );
00117
00119 void ResizeColumnToContents ( int column );
00120
00122 void SetUseColumnView(int state);
00123
00125 virtual void Update();
00126
00128 void SetItemDelegate(QAbstractItemDelegate* delegate);
00129
00131
00132 void SetColorArrayName(const char* name);
00133 const char* GetColorArrayName();
00135
00137
00138 void SetColorByArray(bool vis);
00139 bool GetColorByArray();
00140 vtkBooleanMacro(ColorByArray, bool);
00142
00143 virtual void ApplyViewTheme(vtkViewTheme* theme);
00144
00145 protected:
00146 vtkQtTreeView();
00147 ~vtkQtTreeView();
00148
00149 virtual void AddRepresentationInternal(vtkDataRepresentation* rep);
00150 virtual void RemoveRepresentationInternal(vtkDataRepresentation* rep);
00151
00152 private slots:
00153 void slotQtSelectionChanged(const QItemSelection&,const QItemSelection&);
00154
00155 private:
00156 void SetVTKSelection();
00157 unsigned long CurrentSelectionMTime;
00158 unsigned long LastInputMTime;
00159
00160 vtkSetStringMacro(ColorArrayNameInternal);
00161 vtkGetStringMacro(ColorArrayNameInternal);
00162
00163 QPointer<QTreeView> TreeView;
00164 QPointer<QColumnView> ColumnView;
00165 QPointer<QWidget> Widget;
00166 QPointer<QVBoxLayout> Layout;
00167 QPointer<QItemSelectionModel> SelectionModel;
00168 QList<int> HiddenColumns;
00169 vtkQtTreeModelAdapter* TreeAdapter;
00170 QAbstractItemView* View;
00171 char* ColorArrayNameInternal;
00172 QFilterTreeProxyModel* TreeFilter;
00173
00174
00175 vtkSmartPointer<vtkApplyColors> ApplyColors;
00176
00177
00178 vtkQtTreeView(const vtkQtTreeView&);
00179 void operator=(const vtkQtTreeView&);
00180
00181 };
00182
00183 #endif