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 =========================================================================*/
28 #ifndef vtkQtDebugLeaksModel_h
29 #define vtkQtDebugLeaksModel_h
30 
31 #include "vtkGUISupportQtModule.h" // For export macro
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 
48  QList<vtkObjectBase*> getObjects(const QString& className);
49 
55  QStandardItemModel* referenceCountModel(const QString& className);
56 
57 protected slots:
58 
59  void addObject(vtkObjectBase* object);
60  void removeObject(vtkObjectBase* object);
61  void registerObject(vtkObjectBase* object);
62  void processPendingObjects();
63  void onAboutToQuit();
64 
65  // Inherited method from QAbstractItemModel
66  virtual Qt::ItemFlags flags(const QModelIndex &index) const;
67 
68 private:
69 
70  class qInternal;
71  qInternal* Internal;
72 
73  class qObserver;
74  qObserver* Observer;
75 
76  Q_DISABLE_COPY(vtkQtDebugLeaksModel);
77 };
78 
79 
80 // TODO - move to private
81 //-----------------------------------------------------------------------------
82 class ReferenceCountModel : public QStandardItemModel
83 {
84  Q_OBJECT
85 
86 public:
87  ReferenceCountModel(QObject* p=0);
89  void addObject(vtkObjectBase* obj);
90  void removeObject(vtkObjectBase* obj);
91  QString pointerAsString(void* ptr);
92 
93  // Inherited method from QAbstractItemModel
94  virtual Qt::ItemFlags flags(const QModelIndex &index) const;
95 
96 protected slots:
97  void updateReferenceCounts();
98 };
99 
100 
101 #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:65
ReferenceCountModel(QObject *p=0)
void addObject(vtkObjectBase *obj)
virtual Qt::ItemFlags flags(const QModelIndex &index) const