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 =========================================================================*/
27 #ifndef vtkQtDebugLeaksModel_h
28 #define vtkQtDebugLeaksModel_h
29 
30 #include "vtkGUISupportQtModule.h" // For export macro
31 #include <QStandardItemModel>
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  virtual ~vtkQtDebugLeaksModel();
43 
45  QList<vtkObjectBase*> getObjects(const QString& className);
46 
51  QStandardItemModel* referenceCountModel(const QString& className);
52 
53 protected slots:
54 
55  void addObject(vtkObjectBase* object);
56  void removeObject(vtkObjectBase* object);
57  void registerObject(vtkObjectBase* object);
58  void processPendingObjects();
59  void onAboutToQuit();
60 
61  // Inherited method from QAbstractItemModel
62  virtual Qt::ItemFlags flags(const QModelIndex &index) const;
63 
64 private:
65 
66  class qInternal;
67  qInternal* Internal;
68 
69  class qObserver;
70  qObserver* Observer;
71 
72  Q_DISABLE_COPY(vtkQtDebugLeaksModel);
73 };
74 
75 
76 // TODO - move to private
77 //-----------------------------------------------------------------------------
78 class ReferenceCountModel : public QStandardItemModel
79 {
80  Q_OBJECT
81 
82 public:
83  ReferenceCountModel(QObject* p=0);
85  void addObject(vtkObjectBase* obj);
86  void removeObject(vtkObjectBase* obj);
87  QString pointerAsString(void* ptr);
88 
89  // Inherited method from QAbstractItemModel
90  virtual Qt::ItemFlags flags(const QModelIndex &index) const;
91 
92 protected slots:
93  void updateReferenceCounts();
94 };
95 
96 
97 #endif
model class that observes the vtkDebugLeaks singleton
void removeObject(vtkObjectBase *obj)
void updateReferenceCounts()
QString pointerAsString(void *ptr)
#define VTKGUISUPPORTQT_EXPORT
abstract base class for most VTK objects
Definition: vtkObjectBase.h:59
ReferenceCountModel(QObject *p=0)
void addObject(vtkObjectBase *obj)
virtual Qt::ItemFlags flags(const QModelIndex &index) const