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 "vtkGUISupportQtModule.h" // For export macro 00031 #include "QVTKWin32Header.h" 00032 #include <QStandardItemModel> 00033 00034 class vtkObjectBase; 00035 00036 class VTKGUISUPPORTQT_EXPORT vtkQtDebugLeaksModel : public QStandardItemModel 00037 { 00038 Q_OBJECT 00039 00040 public: 00041 00042 vtkQtDebugLeaksModel(QObject* p=0); 00043 virtual ~vtkQtDebugLeaksModel(); 00044 00046 QList<vtkObjectBase*> getObjects(const QString& className); 00047 00052 QStandardItemModel* referenceCountModel(const QString& className); 00053 00054 protected slots: 00055 00056 void addObject(vtkObjectBase* object); 00057 void removeObject(vtkObjectBase* object); 00058 void registerObject(vtkObjectBase* object); 00059 void processPendingObjects(); 00060 void onAboutToQuit(); 00061 00062 // Inherited method from QAbstractItemModel 00063 virtual Qt::ItemFlags flags(const QModelIndex &index) const; 00064 00065 private: 00066 00067 class qInternal; 00068 qInternal* Internal; 00069 00070 class qObserver; 00071 qObserver* Observer; 00072 00073 Q_DISABLE_COPY(vtkQtDebugLeaksModel); 00074 }; 00075 00076 00077 // TODO - move to private 00078 //----------------------------------------------------------------------------- 00079 class ReferenceCountModel : public QStandardItemModel 00080 { 00081 Q_OBJECT 00082 00083 public: 00084 ReferenceCountModel(QObject* p=0); 00085 ~ReferenceCountModel(); 00086 void addObject(vtkObjectBase* obj); 00087 void removeObject(vtkObjectBase* obj); 00088 QString pointerAsString(void* ptr); 00089 00090 // Inherited method from QAbstractItemModel 00091 virtual Qt::ItemFlags flags(const QModelIndex &index) const; 00092 00093 protected slots: 00094 void updateReferenceCounts(); 00095 }; 00096 00097 00098 #endif