VTK  9.0.2
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  vtkQtDebugLeaksModel(QObject* p = nullptr);
40 
44  QList<vtkObjectBase*> getObjects(const QString& className);
45 
51  QStandardItemModel* referenceCountModel(const QString& className);
52 
53 protected slots:
54 
55  void addObject(vtkObjectBase* object);
56  void removeObject(vtkObjectBase* object);
59  void onAboutToQuit();
60 
61  // Inherited method from QAbstractItemModel
62  Qt::ItemFlags flags(const QModelIndex& index) const override;
63 
64 private:
65  class qInternal;
66  qInternal* Internal;
67 
68  class qObserver;
69  qObserver* Observer;
70 
71  Q_DISABLE_COPY(vtkQtDebugLeaksModel);
72 };
73 
74 // TODO - move to private
75 //-----------------------------------------------------------------------------
76 class ReferenceCountModel : public QStandardItemModel
77 {
78  Q_OBJECT
79 
80 public:
81  ReferenceCountModel(QObject* p = nullptr);
85  QString pointerAsString(void* ptr);
86 
87  // Inherited method from QAbstractItemModel
88  Qt::ItemFlags flags(const QModelIndex& index) const override;
89 
90 protected slots:
92 };
93 
94 #endif
95 // VTK-HeaderTest-Exclude: vtkQtDebugLeaksModel.h
void updateReferenceCounts()
Qt::ItemFlags flags(const QModelIndex &index) const override
void removeObject(vtkObjectBase *obj)
~ReferenceCountModel() override
QString pointerAsString(void *ptr)
void addObject(vtkObjectBase *obj)
ReferenceCountModel(QObject *p=nullptr)
abstract base class for most VTK objects
Definition: vtkObjectBase.h:64
model class that observes the vtkDebugLeaks singleton
void removeObject(vtkObjectBase *object)
QList< vtkObjectBase * > getObjects(const QString &className)
Get the list of objects in the model that have the given class name.
~vtkQtDebugLeaksModel() override
void registerObject(vtkObjectBase *object)
QStandardItemModel * referenceCountModel(const QString &className)
Return an item model that contains only objects with the given class name.
vtkQtDebugLeaksModel(QObject *p=nullptr)
void addObject(vtkObjectBase *object)
Qt::ItemFlags flags(const QModelIndex &index) const override
@ index
Definition: vtkX3D.h:252