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 #include "vtkConfigure.h" //for VTK_OVERRIDE
35 
36 class vtkObjectBase;
37 
38 class VTKGUISUPPORTQT_EXPORT vtkQtDebugLeaksModel : public QStandardItemModel
39 {
40  Q_OBJECT
41 
42 public:
43 
44  vtkQtDebugLeaksModel(QObject* p=0);
45  ~vtkQtDebugLeaksModel() VTK_OVERRIDE;
46 
50  QList<vtkObjectBase*> getObjects(const QString& className);
51 
57  QStandardItemModel* referenceCountModel(const QString& className);
58 
59 protected slots:
60 
61  void addObject(vtkObjectBase* object);
62  void removeObject(vtkObjectBase* object);
63  void registerObject(vtkObjectBase* object);
64  void processPendingObjects();
65  void onAboutToQuit();
66 
67  // Inherited method from QAbstractItemModel
68  Qt::ItemFlags flags(const QModelIndex &index) const VTK_OVERRIDE;
69 
70 private:
71 
72  class qInternal;
73  qInternal* Internal;
74 
75  class qObserver;
76  qObserver* Observer;
77 
78  Q_DISABLE_COPY(vtkQtDebugLeaksModel);
79 };
80 
81 
82 // TODO - move to private
83 //-----------------------------------------------------------------------------
84 class ReferenceCountModel : public QStandardItemModel
85 {
86  Q_OBJECT
87 
88 public:
89  ReferenceCountModel(QObject* p=0);
90  ~ReferenceCountModel() VTK_OVERRIDE;
91  void addObject(vtkObjectBase* obj);
92  void removeObject(vtkObjectBase* obj);
93  QString pointerAsString(void* ptr);
94 
95  // Inherited method from QAbstractItemModel
96  Qt::ItemFlags flags(const QModelIndex &index) const VTK_OVERRIDE;
97 
98 protected slots:
99  void updateReferenceCounts();
100 };
101 
102 
103 #endif
model class that observes the vtkDebugLeaks singleton
abstract base class for most VTK objects
Definition: vtkObjectBase.h:68