VTK
vtkQtTableModelAdapter.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkQtTableModelAdapter.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 vtkQtTableModelAdapter_h
36#define vtkQtTableModelAdapter_h
37
38#include "vtkConfigure.h"
39#include "vtkGUISupportQtModule.h" // For export macro
41#include <QImage> // Needed for icon support
42
43class vtkSelection;
44class vtkTable;
45class vtkVariant;
46
47class QMimeData;
48
49class VTKGUISUPPORTQT_EXPORT vtkQtTableModelAdapter : public vtkQtAbstractModelAdapter
50{
51 Q_OBJECT
52
53public:
54 vtkQtTableModelAdapter(QObject *parent = 0);
55 vtkQtTableModelAdapter(vtkTable* table, QObject *parent = 0);
57
59
65
67
71 const QModelIndexList qmil) const;
72 virtual QItemSelection VTKIndexSelectionToQItemSelection(
73 vtkSelection *vtksel) const;
75
76 virtual void SetKeyColumnName(const char* name);
77 virtual void SetColorColumnName(const char* name);
78 void SetIconIndexColumnName(const char* name);
79
80 enum
81 {
82 HEADER = 0,
83 ITEM = 1
84 };
85
86 enum
87 {
88 COLORS = 0,
89 ICONS = 1,
90 NONE = 2
91 };
92
98
104
107
109
112 void setTable(vtkTable* table);
113 vtkTable* table() const { return this->Table; }
114 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
115 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
116 Qt::ItemFlags flags(const QModelIndex &index) const;
117 QVariant headerData(int section, Qt::Orientation orientation,
118 int role = Qt::DisplayRole) const;
119 QModelIndex index(int row, int column,
120 const QModelIndex &parent = QModelIndex()) const;
121 QModelIndex parent(const QModelIndex &index) const;
122 int rowCount(const QModelIndex &parent = QModelIndex()) const;
123 int columnCount(const QModelIndex &parent = QModelIndex()) const;
125
126 virtual bool dropMimeData(const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent) ;
127 virtual QMimeData * mimeData ( const QModelIndexList & indexes ) const;
128 virtual QStringList mimeTypes () const ;
129 Qt::DropActions supportedDropActions() const;
130
131 void SetIconSheet(QImage sheet);
132 void SetIconSize(int w, int h);
133 void SetIconSheetSize(int w, int h);
134
135signals:
137
138private:
139
140 void getValue(int row, int column, vtkVariant& retVal) const;
141 bool noTableCheck() const;
142 void updateModelColumnHashTables();
143 QVariant getColorIcon(int row) const;
144 QVariant getIcon(int row) const;
145
146 bool SplitMultiComponentColumns;
147 vtkTable* Table;
148 int DecorationLocation;
149 int DecorationStrategy;
150 QImage IconSheet;
151 int IconSize[2];
152 int IconSheetSize[2];
153 int IconIndexColumn;
154
155 class vtkInternal;
156 vtkInternal* Internal;
157
158 vtkQtTableModelAdapter(const vtkQtTableModelAdapter &) VTK_DELETE_FUNCTION;
159 void operator=(const vtkQtTableModelAdapter&) VTK_DELETE_FUNCTION;
160};
161
162#endif
general representation of visualization data
Definition: vtkDataObject.h:65
Superclass for Qt model adapters.
Adapts a table to a Qt item model.
vtkQtTableModelAdapter(QObject *parent=0)
vtkQtTableModelAdapter(vtkTable *table, QObject *parent=0)
void setTable(vtkTable *table)
Set up the model based on the current table.
virtual void SetVTKDataObject(vtkDataObject *data)
Set/Get the VTK data object as input to this adapter.
void SetIconIndexColumnName(const char *name)
QModelIndex parent(const QModelIndex &index) const
virtual vtkDataObject * GetVTKDataObject() const
void selectionDropped(vtkSelection *)
void SetSplitMultiComponentColumns(bool value)
void SetDecorationLocation(int s)
Specify how to color rows if colors are provided by SetColorColumnName().
Qt::DropActions supportedDropActions() const
virtual QStringList mimeTypes() const
bool GetSplitMultiComponentColumns() const
virtual vtkSelection * QModelIndexListToVTKIndexSelection(const QModelIndexList qmil) const
Selection conversion from VTK land to Qt land.
int columnCount(const QModelIndex &parent=QModelIndex()) const
int rowCount(const QModelIndex &parent=QModelIndex()) const
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
void SetIconSheetSize(int w, int h)
void SetDecorationStrategy(int s)
Specify how to color rows if colors are provided by SetColorColumnName().
virtual QItemSelection VTKIndexSelectionToQItemSelection(vtkSelection *vtksel) const
Qt::ItemFlags flags(const QModelIndex &index) const
virtual void SetKeyColumnName(const char *name)
virtual void SetColorColumnName(const char *name)
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
virtual QMimeData * mimeData(const QModelIndexList &indexes) const
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
void SetIconSheet(QImage sheet)
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
void SetIconSize(int w, int h)
A node in a selection tree.
Definition: vtkSelection.h:44
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:69
A atomic type representing the union of many types.
Definition: vtkVariant.h:76
@ orientation
Definition: vtkX3D.h:262
@ value
Definition: vtkX3D.h:220
@ name
Definition: vtkX3D.h:219
@ index
Definition: vtkX3D.h:246
@ data
Definition: vtkX3D.h:315