ctkTestWrappedVTKQInvokable.h 958 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef __ctkTestWrappedVTKQInvokable_h
  2. #define __ctkTestWrappedVTKQInvokable_h
  3. // Qt includes
  4. #include <QObject>
  5. // VTK includes
  6. #include <vtkTable.h>
  7. class ctkTestWrappedVTKQInvokable : public QObject
  8. {
  9. Q_OBJECT
  10. public:
  11. ctkTestWrappedVTKQInvokable(QObject * newParent = 0) : QObject(newParent)
  12. {
  13. this->MyTable = vtkTable::New();
  14. }
  15. virtual ~ctkTestWrappedVTKQInvokable()
  16. {
  17. this->MyTable->Delete();
  18. }
  19. /// Example of 'invokable' returning a VTK object
  20. /// Declaring a method as invokable allows to add it to the MetaObject system
  21. /// \note When a method returns a value, we tend to use Q_INVOKABLE
  22. /// instead of declaring a slot.
  23. Q_INVOKABLE vtkTable * getTable() const
  24. {
  25. return this->MyTable;
  26. }
  27. /// Example of 'invokable' accepting a VTK object as parameter
  28. Q_INVOKABLE void setTable(vtkTable * newTable)
  29. {
  30. this->MyTable = newTable;
  31. }
  32. private:
  33. vtkTable * MyTable;
  34. };
  35. #endif