VTK: GUISupport/Qt/Testing/Cxx/QVTKTableModelAdapterTestClass.h Source File

| VTK 9.3.1

QVTKTableModelAdapterTestClass.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
3
4 #ifndef QVTKTableModelAdapterTestClass_h
5 #define QVTKTableModelAdapterTestClass_h
6
13 #include "QVTKTableModelAdapter.h"
14
15 #include <QAbstractTableModel>
16 #include <QStringList>
17 #include <QVector>
18
19 class QVTKTableModelAdapterTestClass : public QAbstractTableModel
20 {
21 Q_OBJECT
22
23 public:
24 QVTKTableModelAdapterTestClass(QObject* parent = nullptr);
25
26 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
27 int columnCount(const QModelIndex& parent = QModelIndex()) const override;
28
29 bool insertRows(int row, int count, const QModelIndex& parent = QModelIndex()) override;
30 bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex()) override;
31
32 bool insertColumns(int column, int count, const QModelIndex& parent = QModelIndex()) override;
33 bool removeColumns(int column, int count, const QModelIndex& parent = QModelIndex()) override;
34
35 QVariant data(const QModelIndex& index, int role) const override;
36 bool setData(const QModelIndex& index, const QVariant& value, int role) override;
37 QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
38
39 public Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
40 void runTests();
41
42 protected:
43 int Errors;
44
45 QVector<QVector<double>> ColumnData;
46 QStringList ColumnNames;
47
48 QVTKTableModelAdapter* TargetAdapter;
49
50 void processEvents();
51 void testClearTable();
52 void testChangeHeader(int column, const QString& name);
53 void testColumnInsertion(int column, const QStringList& names);
54 void testColumnRemoval(int column, int n);
55 void testRowInsertion(int row, int n);
56 void testRowRemoval(int row, int n);
57
58 void testInsertRemoveColumns();
59 void testInsertRemoveRows();
60 };
61
62 #endif
QVTKTableModelAdapter.h
QVTKTableModelAdapterTestClass
Class required by TestQVTKTableModelAdapter to run Qt tests involving event loop.
Definition: QVTKTableModelAdapterTestClass.h:20
QVTKTableModelAdapterTestClass::TargetAdapter
QVTKTableModelAdapter * TargetAdapter
Definition: QVTKTableModelAdapterTestClass.h:48
QVTKTableModelAdapterTestClass::QVTKTableModelAdapterTestClass
QVTKTableModelAdapterTestClass(QObject *parent=nullptr)
QVTKTableModelAdapterTestClass::ColumnNames
QStringList ColumnNames
Definition: QVTKTableModelAdapterTestClass.h:46
QVTKTableModelAdapterTestClass::rowCount
int rowCount(const QModelIndex &parent=QModelIndex()) const override
QVTKTableModelAdapterTestClass::data
QVariant data(const QModelIndex &index, int role) const override
QVTKTableModelAdapterTestClass::testRowRemoval
void testRowRemoval(int row, int n)
QVTKTableModelAdapterTestClass::insertRows
bool insertRows(int row, int count, const QModelIndex &parent=QModelIndex()) override
QVTKTableModelAdapterTestClass::processEvents
void processEvents()
QVTKTableModelAdapterTestClass::Errors
int Errors
Definition: QVTKTableModelAdapterTestClass.h:43
QVTKTableModelAdapterTestClass::testColumnRemoval
void testColumnRemoval(int column, int n)
QVTKTableModelAdapterTestClass::testColumnInsertion
void testColumnInsertion(int column, const QStringList &names)
QVTKTableModelAdapterTestClass::runTests
void runTests()
QVTKTableModelAdapterTestClass::columnCount
int columnCount(const QModelIndex &parent=QModelIndex()) const override
QVTKTableModelAdapterTestClass::ColumnData
QVector< QVector< double > > ColumnData
Definition: QVTKTableModelAdapterTestClass.h:45
QVTKTableModelAdapterTestClass::testInsertRemoveColumns
void testInsertRemoveColumns()
QVTKTableModelAdapterTestClass::testClearTable
void testClearTable()
QVTKTableModelAdapterTestClass::testRowInsertion
void testRowInsertion(int row, int n)
QVTKTableModelAdapterTestClass::headerData
QVariant headerData(int section, Qt::Orientation orientation, int role) const override
QVTKTableModelAdapterTestClass::removeColumns
bool removeColumns(int column, int count, const QModelIndex &parent=QModelIndex()) override
QVTKTableModelAdapterTestClass::testInsertRemoveRows
void testInsertRemoveRows()
QVTKTableModelAdapterTestClass::removeRows
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex()) override
QVTKTableModelAdapterTestClass::setData
bool setData(const QModelIndex &index, const QVariant &value, int role) override
QVTKTableModelAdapterTestClass::insertColumns
bool insertColumns(int column, int count, const QModelIndex &parent=QModelIndex()) override
QVTKTableModelAdapterTestClass::testChangeHeader
void testChangeHeader(int column, const QString &name)
QVTKTableModelAdapter
An adapter to create a vtkTable from an QAbstractItemModel.
Definition: QVTKTableModelAdapter.h:34
vtkX3D::orientation
@ orientation
Definition: vtkX3D.h:262
vtkX3D::value
@ value
Definition: vtkX3D.h:220
vtkX3D::name
@ name
Definition: vtkX3D.h:219
vtkX3D::index
@ index
Definition: vtkX3D.h:246