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=nullptr);
43  ~vtkQtDebugLeaksModel() override;
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  Qt::ItemFlags flags(const QModelIndex &index) const override;
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=nullptr);
88  ~ReferenceCountModel() override;
89  void addObject(vtkObjectBase* obj);
90  void removeObject(vtkObjectBase* obj);
91  QString pointerAsString(void* ptr);
92 
93  // Inherited method from QAbstractItemModel
94  Qt::ItemFlags flags(const QModelIndex &index) const override;
95 
96 protected slots:
97  void updateReferenceCounts();
98 };
99 
100 
101 #endif
model class that observes the vtkDebugLeaks singleton
abstract base class for most VTK objects
Definition: vtkObjectBase.h:65