VTK  9.1.0
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-------------------------------------------------------------------------*/
32#ifndef vtkQtTableModelAdapter_h
33#define vtkQtTableModelAdapter_h
34
35#include "vtkGUISupportQtModule.h" // For export macro
37#include <QImage> // Needed for icon support
38
39class vtkSelection;
40class vtkTable;
41class vtkVariant;
42
43class QMimeData;
44
45class VTKGUISUPPORTQT_EXPORT vtkQtTableModelAdapter : public vtkQtAbstractModelAdapter
46{
47 Q_OBJECT
48
49public:
50 vtkQtTableModelAdapter(QObject* parent = nullptr);
51 vtkQtTableModelAdapter(vtkTable* table, QObject* parent = nullptr);
53
55
61
63
66 vtkSelection* QModelIndexListToVTKIndexSelection(const QModelIndexList qmil) const override;
67 QItemSelection VTKIndexSelectionToQItemSelection(vtkSelection* vtksel) const override;
69
70 void SetKeyColumnName(const char* name) override;
71 void SetColorColumnName(const char* name) override;
72 void SetIconIndexColumnName(const char* name);
73
74 enum
75 {
76 HEADER = 0,
77 ITEM = 1
78 };
79
80 enum
81 {
82 COLORS = 0,
83 ICONS = 1,
84 NONE = 2
85 };
86
92
98
101
103
106 void setTable(vtkTable* table);
107 vtkTable* table() const { return this->Table; }
108 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
109 bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
110 Qt::ItemFlags flags(const QModelIndex& index) const override;
111 QVariant headerData(
112 int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
113 QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override;
114 QModelIndex parent(const QModelIndex& index) const override;
115 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
116 int columnCount(const QModelIndex& parent = QModelIndex()) const override;
118
119 bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column,
120 const QModelIndex& parent) override;
121 QMimeData* mimeData(const QModelIndexList& indexes) const override;
122 QStringList mimeTypes() const override;
123 Qt::DropActions supportedDropActions() const override;
124
125 void SetIconSheet(QImage sheet);
126 void SetIconSize(int w, int h);
127 void SetIconSheetSize(int w, int h);
128
129Q_SIGNALS:
131
132private:
133 void getValue(int row, int column, vtkVariant& retVal) const;
134 bool noTableCheck() const;
135 void updateModelColumnHashTables();
136 QVariant getColorIcon(int row) const;
137 QVariant getIcon(int row) const;
138
139 bool SplitMultiComponentColumns;
140 vtkTable* Table;
141 int DecorationLocation;
142 int DecorationStrategy;
143 QImage IconSheet;
144 int IconSize[2];
145 int IconSheetSize[2];
146 int IconIndexColumn;
147
148 class vtkInternal;
149 vtkInternal* Internal;
150
152 void operator=(const vtkQtTableModelAdapter&) = delete;
153};
154
155#endif
156// VTK-HeaderTest-Exclude: vtkQtTableModelAdapter.h
general representation of visualization data
vtkFrustumSelector is a vtkSelector that selects elements based on whether they are inside or interse...
Superclass for Qt model adapters.
Adapts a table to a Qt item model.
void setTable(vtkTable *table)
Set up the model based on the current table.
vtkDataObject * GetVTKDataObject() const override
Set/Get the VTK data object as input to this adapter.
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Set up the model based on the current table.
void SetIconIndexColumnName(const char *name)
~vtkQtTableModelAdapter() override
void selectionDropped(vtkSelection *)
void SetSplitMultiComponentColumns(bool value)
void SetDecorationLocation(int s)
Specify how to color rows if colors are provided by SetColorColumnName().
Qt::ItemFlags flags(const QModelIndex &index) const override
Set up the model based on the current table.
bool GetSplitMultiComponentColumns() const
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Set up the model based on the current table.
vtkSelection * QModelIndexListToVTKIndexSelection(const QModelIndexList qmil) const override
Selection conversion from VTK land to Qt land.
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Set up the model based on the current table.
QItemSelection VTKIndexSelectionToQItemSelection(vtkSelection *vtksel) const override
Selection conversion from VTK land to Qt land.
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
Set up the model based on the current table.
void SetIconSheetSize(int w, int h)
void SetDecorationStrategy(int s)
Specify how to color rows if colors are provided by SetColorColumnName().
void SetVTKDataObject(vtkDataObject *data) override
Set/Get the VTK data object as input to this adapter.
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override
void SetKeyColumnName(const char *name) override
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
Set up the model based on the current table.
QModelIndex parent(const QModelIndex &index) const override
Set up the model based on the current table.
Qt::DropActions supportedDropActions() const override
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
Set up the model based on the current table.
vtkQtTableModelAdapter(vtkTable *table, QObject *parent=nullptr)
QStringList mimeTypes() const override
void SetIconSheet(QImage sheet)
QMimeData * mimeData(const QModelIndexList &indexes) const override
void SetIconSize(int w, int h)
vtkTable * table() const
Set up the model based on the current table.
void SetColorColumnName(const char *name) override
vtkQtTableModelAdapter(QObject *parent=nullptr)
data object that represents a "selection" in VTK.
Definition: vtkSelection.h:163
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:172
A atomic type representing the union of many types.
Definition: vtkVariant.h:145
@ orientation
Definition: vtkX3D.h:268
@ value
Definition: vtkX3D.h:226
@ name
Definition: vtkX3D.h:225
@ index
Definition: vtkX3D.h:252
@ data
Definition: vtkX3D.h:321