VTK
vtkQtDebugLeaksModel.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkQtDebugLeaksModel.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
27 #ifndef vtkQtDebugLeaksModel_h
28 #define vtkQtDebugLeaksModel_h
29 
30 #include "vtkGUISupportQtModule.h" // For export macro
31 #include "QVTKWin32Header.h"
32 #include <QStandardItemModel>
33 
34 class vtkObjectBase;
35 
36 class VTKGUISUPPORTQT_EXPORT vtkQtDebugLeaksModel : public QStandardItemModel
37 {
38  Q_OBJECT
39 
40 public:
41 
42  vtkQtDebugLeaksModel(QObject* p=0);
43  virtual ~vtkQtDebugLeaksModel();
44 
46  QList<vtkObjectBase*> getObjects(const QString& className);
47 
52  QStandardItemModel* referenceCountModel(const QString& className);
53 
54 protected slots:
55 
56  void addObject(vtkObjectBase* object);
57  void removeObject(vtkObjectBase* object);
58  void registerObject(vtkObjectBase* object);
59  void processPendingObjects();
60  void onAboutToQuit();
61 
62  // Inherited method from QAbstractItemModel
63  virtual Qt::ItemFlags flags(const QModelIndex &index) const;
64 
65 private:
66 
67  class qInternal;
68  qInternal* Internal;
69 
70  class qObserver;
71  qObserver* Observer;
72 
73  Q_DISABLE_COPY(vtkQtDebugLeaksModel);
74 };
75 
76 
77 // TODO - move to private
78 //-----------------------------------------------------------------------------
79 class ReferenceCountModel : public QStandardItemModel
80 {
81  Q_OBJECT
82 
83 public:
84  ReferenceCountModel(QObject* p=0);
86  void addObject(vtkObjectBase* obj);
87  void removeObject(vtkObjectBase* obj);
88  QString pointerAsString(void* ptr);
89 
90  // Inherited method from QAbstractItemModel
91  virtual Qt::ItemFlags flags(const QModelIndex &index) const;
92 
93 protected slots:
94  void updateReferenceCounts();
95 };
96 
97 
98 #endif
model class that observes the vtkDebugLeaks singleton
void removeObject(vtkObjectBase *obj)
void updateReferenceCounts()
QString pointerAsString(void *ptr)
abstract base class for most VTK objects
Definition: vtkObjectBase.h:59
ReferenceCountModel(QObject *p=0)
void addObject(vtkObjectBase *obj)
virtual Qt::ItemFlags flags(const QModelIndex &index) const