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