00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00033 #ifndef __vtkQtItemView_h
00034 #define __vtkQtItemView_h
00035
00036 #include "QVTKWin32Header.h"
00037 #include "vtkView.h"
00038
00039 #include <QAbstractItemView>
00040 #include "vtkQtAbstractModelAdapter.h"
00041
00043
00045 class vtkQtItemView;
00046 class QItemSelectionModel;
00048
00049 class QVTK_EXPORT vtkQtSignalHandler : public QObject
00050 {
00051 Q_OBJECT
00052 public:
00053 void setTarget(vtkQtItemView* t) { this->Target = t; }
00054 public slots:
00055 void slotSelectionChanged(const QItemSelection&, const QItemSelection&);
00056 private:
00057 vtkQtItemView* Target;
00058 };
00059
00060 class QVTK_EXPORT vtkQtItemView : public vtkView
00061 {
00062 public:
00063 static vtkQtItemView *New();
00064 vtkTypeRevisionMacro(vtkQtItemView, vtkView);
00065 void PrintSelf(ostream& os, vtkIndent indent);
00066
00068
00069 virtual void SetItemView(QAbstractItemView*);
00070 QAbstractItemView* GetItemView();
00072
00074
00075 virtual void SetItemModelAdapter(vtkQtAbstractModelAdapter* qma);
00076 vtkQtAbstractModelAdapter* GetItemModelAdapter();
00078
00080 virtual void Update();
00081
00082
00084
00085 vtkSetMacro(UseValueSelection,bool);
00086 vtkGetMacro(UseValueSelection,bool);
00088
00090
00091 vtkSetStringMacro(ValueSelectionArrayName);
00092 vtkGetStringMacro(ValueSelectionArrayName);
00094
00095 protected:
00096 vtkQtItemView();
00097 ~vtkQtItemView();
00098
00100
00101 virtual void ProcessEvents(vtkObject* caller, unsigned long eventId,
00102 void* callData);
00104
00107 virtual void AddInputConnection(vtkAlgorithmOutput* conn);
00108
00110 virtual void RemoveInputConnection(vtkAlgorithmOutput* conn);
00111
00113 void QtSelectionChanged(const QItemSelection&, const QItemSelection&);
00114
00118 QItemSelectionModel* GetSelectionModel();
00119
00120 private:
00121 vtkQtItemView(const vtkQtItemView&);
00122 void operator=(const vtkQtItemView&);
00123
00125 QAbstractItemView *ItemViewPtr;
00126
00128 vtkQtAbstractModelAdapter *ModelAdapterPtr;
00129
00131 QItemSelectionModel *SelectionModel;
00132
00135 int CheckViewAndModelError();
00136
00138
00139 friend class vtkQtSignalHandler;
00140 vtkQtSignalHandler SignalHandler;
00142
00144 bool Selecting;
00145
00147 bool UseValueSelection;
00148
00150 char *ValueSelectionArrayName;
00151
00152 bool IOwnSelectionModel;
00153
00154 };
00155
00156 #endif