VTK  9.2.6
QVTKTableModelAdapterTestClass.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: TestQtTableModelAdapter.cxx
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#ifndef QVTKTableModelAdapterTestClass_h
17#define QVTKTableModelAdapterTestClass_h
18
24
26
27#include <QAbstractTableModel>
28#include <QStringList>
29#include <QVector>
30
31class QVTKTableModelAdapterTestClass : public QAbstractTableModel
32{
33 Q_OBJECT
34
35public:
36 QVTKTableModelAdapterTestClass(QObject* parent = nullptr);
37
38 virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
39 virtual int columnCount(const QModelIndex& parent = QModelIndex()) const;
40
41 virtual bool insertRows(int row, int count, const QModelIndex& parent = QModelIndex());
42 virtual bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex());
43
44 virtual bool insertColumns(int column, int count, const QModelIndex& parent = QModelIndex());
45 virtual bool removeColumns(int column, int count, const QModelIndex& parent = QModelIndex());
46
47 virtual QVariant data(const QModelIndex& index, int role) const;
48 virtual bool setData(const QModelIndex& index, const QVariant& value, int role);
49 virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const;
50
51public Q_SLOTS:
52 void runTests();
53
54protected:
55 int Errors;
56
57 QVector<QVector<double>> ColumnData;
58 QStringList ColumnNames;
59
61
64 void testChangeHeader(int column, const QString& name);
65 void testColumnInsertion(int column, const QStringList& names);
66 void testColumnRemoval(int column, int n);
67 void testRowInsertion(int row, int n);
68 void testRowRemoval(int row, int n);
69
72};
73
74#endif
QVTKTableModelAdapterTestClass(QObject *parent=nullptr)
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const
virtual bool insertRows(int row, int count, const QModelIndex &parent=QModelIndex())
void testRowRemoval(int row, int n)
virtual bool removeColumns(int column, int count, const QModelIndex &parent=QModelIndex())
void testColumnRemoval(int column, int n)
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const
void testColumnInsertion(int column, const QStringList &names)
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
virtual QVariant data(const QModelIndex &index, int role) const
virtual bool insertColumns(int column, int count, const QModelIndex &parent=QModelIndex())
virtual bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex())
void testRowInsertion(int row, int n)
virtual bool setData(const QModelIndex &index, const QVariant &value, int role)
void testChangeHeader(int column, const QString &name)
An adapter to create a vtkTable from an QAbstractItemModel.