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 class vtkObjectBase;
32 
33 class VTKGUISUPPORTQT_EXPORT vtkQtDebugLeaksModel : public QStandardItemModel
34 {
35  Q_OBJECT
36 
37 public:
38 
39  vtkQtDebugLeaksModel(QObject* p=nullptr);
40  ~vtkQtDebugLeaksModel() override;
41 
45  QList<vtkObjectBase*> getObjects(const QString& className);
46 
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  Qt::ItemFlags flags(const QModelIndex &index) const override;
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=nullptr);
85  ~ReferenceCountModel() override;
86  void addObject(vtkObjectBase* obj);
87  void removeObject(vtkObjectBase* obj);
88  QString pointerAsString(void* ptr);
89 
90  // Inherited method from QAbstractItemModel
91  Qt::ItemFlags flags(const QModelIndex &index) const override;
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:62
~ReferenceCountModel() override
ReferenceCountModel(QObject *p=nullptr)
Qt::ItemFlags flags(const QModelIndex &index) const override
void addObject(vtkObjectBase *obj)