PageRenderTime 42ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/Base/QTGUI/qSlicerBaseQTGUIPythonQtDecorators.h

https://github.com/pieper/Slicer4
C Header | 59 lines | 24 code | 13 blank | 22 comment | 0 complexity | 13103fc28c478319af0167c4ca5678f8 MD5 | raw file
  1. /*=auto=========================================================================
  2. Portions (c) Copyright 2005 Brigham and Women's Hospital (BWH)
  3. All Rights Reserved.
  4. See Doc/copyright/copyright.txt
  5. or http://www.slicer.org/copyright/copyright.txt for details.
  6. Program: 3D Slicer
  7. =========================================================================auto=*/
  8. #ifndef __qSlicerBaseQTGUIPythonQtDecorators_h
  9. #define __qSlicerBaseQTGUIPythonQtDecorators_h
  10. // Qt includes
  11. #include <QObject>
  12. // CTK includes
  13. #include <ctkAbstractPythonManager.h>
  14. // SlicerQt includes
  15. #include "qSlicerAbstractModuleRepresentation.h"
  16. #include "qSlicerAbstractModuleWidget.h"
  17. #include "qSlicerAbstractModule.h"
  18. #include "qSlicerBaseQTGUIExport.h"
  19. // NOTE:
  20. //
  21. // For decorators it is assumed that the methods will never be called
  22. // with the self argument as NULL. The self argument is the first argument
  23. // for non-static methods.
  24. //
  25. class Q_SLICER_BASE_QTGUI_EXPORT qSlicerBaseQTGUIPythonQtDecorators : public QObject
  26. {
  27. Q_OBJECT
  28. public:
  29. qSlicerBaseQTGUIPythonQtDecorators(ctkAbstractPythonManager* pythonManager)
  30. {
  31. Q_ASSERT(pythonManager);
  32. pythonManager->registerClassForPythonQt(&qSlicerAbstractModuleWidget::staticMetaObject);
  33. }
  34. public slots:
  35. //----------------------------------------------------------------------------
  36. // qSlicerAbstractModule
  37. qSlicerAbstractModuleWidget* widgetRepresentation(qSlicerAbstractModule* _module)
  38. {
  39. return dynamic_cast<qSlicerAbstractModuleWidget*>(_module->widgetRepresentation());
  40. }
  41. };
  42. #endif