• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

dox/GUISupport/Qt/vtkQtTableModelAdapter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkQtTableModelAdapter.h,v $
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00015 /*-------------------------------------------------------------------------
00016   Copyright 2008 Sandia Corporation.
00017   Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00018   the U.S. Government retains certain rights in this software.
00019 -------------------------------------------------------------------------*/
00034 #ifndef __vtkQtTableModelAdapter_h
00035 #define __vtkQtTableModelAdapter_h
00036 
00037 #include "QVTKWin32Header.h"
00038 #include "vtkType.h"
00039 
00040 #include "vtkQtAbstractModelAdapter.h"
00041 
00042 #include "vtkSelection.h"
00043 #include <QHash>
00044 
00045 class vtkTable;
00046 
00047 class QVTK_EXPORT vtkQtTableModelAdapter : public vtkQtAbstractModelAdapter
00048 {
00049   Q_OBJECT
00050 
00051 public:
00052   vtkQtTableModelAdapter(QObject *parent = 0);
00053   vtkQtTableModelAdapter(vtkTable* table, QObject *parent = 0);
00054   ~vtkQtTableModelAdapter();
00055   
00056   // Set/Get the VTK data object as input to this adapter
00057   virtual void SetVTKDataObject(vtkDataObject *data);
00058   virtual vtkDataObject* GetVTKDataObject() const;
00059   
00060   vtkIdType IdToPedigree(vtkIdType id) const;
00061   vtkIdType PedigreeToId(vtkIdType pedigree) const;
00062   QModelIndex PedigreeToQModelIndex(vtkIdType id) const;
00063   vtkIdType QModelIndexToPedigree(QModelIndex index) const;
00064   
00065   virtual void SetKeyColumnName(const char* name);
00066 
00067   void setTable(vtkTable* table);
00068   vtkTable* table() const { return this->Table; }
00069   QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
00070   bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
00071   Qt::ItemFlags flags(const QModelIndex &index) const;
00072   QVariant headerData(int section, Qt::Orientation orientation,
00073                       int role = Qt::DisplayRole) const;
00074   QModelIndex index(int row, int column,
00075                     const QModelIndex &parent = QModelIndex()) const;
00076   QModelIndex parent(const QModelIndex &index) const;
00077   int rowCount(const QModelIndex &parent = QModelIndex()) const;
00078   int columnCount(const QModelIndex &parent = QModelIndex()) const;
00079 
00080 private:
00081   void GenerateHashMap();
00082   bool noTableCheck() const;
00083 
00084   vtkTable* Table;
00085   QHash<vtkIdType, vtkIdType> IdToPedigreeHash;
00086   QHash<vtkIdType, QModelIndex> PedigreeToIndexHash;
00087   QHash<QModelIndex, vtkIdType> IndexToIdHash;
00088   
00089   QHash<QModelIndex, QVariant> IndexToDecoration;
00090   
00091   vtkQtTableModelAdapter(const vtkQtTableModelAdapter &);  // Not implemented
00092   void operator=(const vtkQtTableModelAdapter&);  // Not implemented.
00093 };
00094 
00095 #endif

Generated by  doxygen 1.7.1