VTK  9.2.6
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  vtkQtDebugLeaksModel(QObject* p = nullptr);
42  ~vtkQtDebugLeaksModel() override;
43 
47  QList<vtkObjectBase*> getObjects(const QString& className);
48 
54  QStandardItemModel* referenceCountModel(const QString& className);
55 
56 protected Q_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 override;
66 
67 private:
68  class qInternal;
69  qInternal* Internal;
70 
71  class qObserver;
72  qObserver* Observer;
73 
74  Q_DISABLE_COPY(vtkQtDebugLeaksModel);
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 Q_SLOTS:
94  void updateReferenceCounts();
95 };
96 
97 #endif
98 // VTK-HeaderTest-Exclude: vtkQtDebugLeaksModel.h
model class that observes the vtkDebugLeaks singleton
void removeObject(vtkObjectBase *obj)
void updateReferenceCounts()
Qt::ItemFlags flags(const QModelIndex &index) const override
QString pointerAsString(void *ptr)
abstract base class for most VTK objects
Definition: vtkObjectBase.h:73
~ReferenceCountModel() override
ReferenceCountModel(QObject *p=nullptr)
void addObject(vtkObjectBase *obj)