qCTKModelTester.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef __qCTKModelTester_h
00016 #define __qCTKModelTester_h
00017
00019 #include <QObject>
00020 #include <QModelIndex>
00021 #include <QPersistentModelIndex>
00022 #include <QList>
00023
00025 #include <qCTKWidgetsExport.h>
00026 #include <qCTKPimpl.h>
00027
00028 #include "qCTKWidgetsExport.h"
00029
00030 class QAbstractItemModel;
00031 class qCTKModelTesterPrivate;
00032
00033 class QCTK_WIDGETS_EXPORT qCTKModelTester: public QObject
00034 {
00035 Q_OBJECT
00036 public:
00037 explicit qCTKModelTester(QObject *parent = 0);
00038 qCTKModelTester(QAbstractItemModel *model, QObject *parent);
00039
00040 void setModel(QAbstractItemModel* model);
00041 QAbstractItemModel* model()const;
00042
00043 void setThrowOnError(bool throwException);
00044 bool throwOnError()const;
00045
00046 virtual void testData(const QModelIndex& index)const;
00047 virtual void testModel()const;
00048 virtual void testModelIndex(const QModelIndex& index)const;
00049 virtual void testParent(const QModelIndex& parent)const;
00050 virtual void testPersistentModelIndex(const QPersistentModelIndex& index)const;
00051
00052 protected slots:
00053 void onColumnsAboutToBeInserted(const QModelIndex & parent, int start, int end);
00054 void onColumnsAboutToBeRemoved(const QModelIndex & parent, int start, int end);
00055 void onColumnsInserted(const QModelIndex & parent, int start, int end);
00056 void onColumnsRemoved(const QModelIndex & parent, int start, int end);
00057 void onDataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight);
00058 void onHeaderDataChanged(Qt::Orientation orientation, int first, int last);
00059 void onLayoutAboutToBeChanged();
00060 void onLayoutChanged();
00061 void onModelAboutToBeReset();
00062 void onModelReset();
00063 void onRowsAboutToBeInserted(const QModelIndex &parent, int start, int end);
00064 void onRowsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
00065 void onRowsInserted(const QModelIndex & parent, int start, int end);
00066 void onRowsRemoved(const QModelIndex & parent, int start, int end);
00067 protected:
00068 virtual void onItemsAboutToBeInserted(const QModelIndex& parent, Qt::Orientation, int start, int end);
00069 virtual void onItemsAboutToBeRemoved(const QModelIndex& parent, Qt::Orientation, int start, int end);
00070 virtual void onItemsInserted(const QModelIndex& parent, Qt::Orientation, int start, int end);
00071 virtual void onItemsRemoved(const QModelIndex& parent, Qt::Orientation, int start, int end);
00072 QList<QPersistentModelIndex> persistentModelIndexes(const QModelIndex& index)const;
00073 virtual void test(bool result, const QString& errorString)const;
00074 private:
00075 QCTK_DECLARE_PRIVATE(qCTKModelTester);
00076 };
00077
00078 #endif