VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkQtDebugLeaksModel.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00027 #ifndef __vtkQtDebugLeaksModel_h 00028 #define __vtkQtDebugLeaksModel_h 00029 00030 #include "QVTKWin32Header.h" 00031 #include <QStandardItemModel> 00032 00033 class vtkObjectBase; 00034 00035 class QVTK_EXPORT vtkQtDebugLeaksModel : public QStandardItemModel 00036 { 00037 Q_OBJECT 00038 00039 public: 00040 00041 vtkQtDebugLeaksModel(QObject* p=0); 00042 virtual ~vtkQtDebugLeaksModel(); 00043 00045 QList<vtkObjectBase*> getObjects(const QString& className); 00046 00051 QStandardItemModel* referenceCountModel(const QString& className); 00052 00053 protected slots: 00054 00055 void addObject(vtkObjectBase* object); 00056 void removeObject(vtkObjectBase* object); 00057 void registerObject(vtkObjectBase* object); 00058 void processPendingObjects(); 00059 void onAboutToQuit(); 00060 00061 // Inherited method from QAbstractItemModel 00062 virtual Qt::ItemFlags flags(const QModelIndex &index) const; 00063 00064 private: 00065 00066 class qInternal; 00067 qInternal* Internal; 00068 00069 class qObserver; 00070 qObserver* Observer; 00071 00072 Q_DISABLE_COPY(vtkQtDebugLeaksModel); 00073 }; 00074 00075 00076 // TODO - move to private 00077 //----------------------------------------------------------------------------- 00078 class ReferenceCountModel : public QStandardItemModel 00079 { 00080 Q_OBJECT 00081 00082 public: 00083 ReferenceCountModel(QObject* p=0); 00084 ~ReferenceCountModel(); 00085 void addObject(vtkObjectBase* obj); 00086 void removeObject(vtkObjectBase* obj); 00087 QString pointerAsString(void* ptr); 00088 00089 // Inherited method from QAbstractItemModel 00090 virtual Qt::ItemFlags flags(const QModelIndex &index) const; 00091 00092 protected slots: 00093 void updateReferenceCounts(); 00094 }; 00095 00096 00097 #endif