VTK  9.4.20241227
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
14
15#include <QAbstractTableModel>
16#include <QStringList>
17#include <QVector>
18
19class QVTKTableModelAdapterTestClass : public QAbstractTableModel
20{
21 Q_OBJECT
22
23public:
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
39public Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
40 void runTests();
41
42protected:
43 int Errors;
44
45 QVector<QVector<double>> ColumnData;
46 QStringList ColumnNames;
47
49
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
60};
61
62#endif
Class required by TestQVTKTableModelAdapter to run Qt tests involving event loop.
QVTKTableModelAdapterTestClass(QObject *parent=nullptr)
int rowCount(const QModelIndex &parent=QModelIndex()) const override
QVariant data(const QModelIndex &index, int role) const override
void testRowRemoval(int row, int n)
bool insertRows(int row, int count, const QModelIndex &parent=QModelIndex()) override
void testColumnRemoval(int column, int n)
void testColumnInsertion(int column, const QStringList &names)
int columnCount(const QModelIndex &parent=QModelIndex()) const override
void testRowInsertion(int row, int n)
QVariant headerData(int section, Qt::Orientation orientation, int role) const override
bool removeColumns(int column, int count, const QModelIndex &parent=QModelIndex()) override
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex()) override
bool setData(const QModelIndex &index, const QVariant &value, int role) override
bool insertColumns(int column, int count, const QModelIndex &parent=QModelIndex()) override
void testChangeHeader(int column, const QString &name)
An adapter to create a vtkTable from an QAbstractItemModel.