21 #ifndef __ctkModelTester_h
22 #define __ctkModelTester_h
26 #include <QModelIndex>
27 #include <QPersistentModelIndex>
32 #include "ctkCoreExport.h"
34 class QAbstractItemModel;
35 class ctkModelTesterPrivate;
47 Q_PROPERTY(
bool nestedInserts READ nestedInserts WRITE setNestedInserts);
48 Q_PROPERTY(
bool testDataEnabled READ testDataEnabled WRITE setTestDataEnabled);
49 Q_PROPERTY(
bool throwOnError READ throwOnError WRITE setThrowOnError);
74 void setModel(QAbstractItemModel* model);
75 QAbstractItemModel* model()
const;
80 void setThrowOnError(
bool throwException);
81 bool throwOnError()
const;
89 void setNestedInserts(
bool enable);
90 bool nestedInserts()
const;
97 void setTestDataEnabled(
bool enable);
98 bool testDataEnabled()
const;
101 void setVerbose(
bool enable);
107 virtual void testData(
const QModelIndex& index)
const;
111 virtual void testModel()
const;
115 virtual void testModelIndex(
const QModelIndex& index)
const;
120 virtual void testParent(
const QModelIndex& parent)
const;
124 virtual void testPersistentModelIndex(
const QPersistentModelIndex& index)
const;
127 void onColumnsAboutToBeInserted(
const QModelIndex & parent,
int start,
int end);
128 void onColumnsAboutToBeRemoved(
const QModelIndex & parent,
int start,
int end);
129 void onColumnsInserted(
const QModelIndex & parent,
int start,
int end);
130 void onColumnsRemoved(
const QModelIndex & parent,
int start,
int end);
131 void onDataChanged(
const QModelIndex & topLeft,
const QModelIndex & bottomRight);
132 void onHeaderDataChanged(Qt::Orientation orientation,
int first,
int last);
133 void onLayoutAboutToBeChanged();
134 void onLayoutChanged();
135 void onModelAboutToBeReset();
137 void onRowsAboutToBeInserted(
const QModelIndex &parent,
int start,
int end);
138 void onRowsAboutToBeRemoved(
const QModelIndex &parent,
int start,
int end);
139 void onRowsInserted(
const QModelIndex & parent,
int start,
int end);
140 void onRowsRemoved(
const QModelIndex & parent,
int start,
int end);
146 virtual void onItemsAboutToBeInserted(
const QModelIndex& parent, Qt::Orientation,
int start,
int end);
151 virtual void onItemsAboutToBeRemoved(
const QModelIndex& parent, Qt::Orientation,
int start,
int end);
156 virtual void onItemsInserted(
const QModelIndex& parent, Qt::Orientation,
int start,
int end);
161 virtual void onItemsRemoved(
const QModelIndex& parent, Qt::Orientation,
int start,
int end);
169 virtual void test(
bool result,
const QString& errorString)
const;
172 QScopedPointer<ctkModelTesterPrivate>
d_ptr;