Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkStepperAdapter.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef QMITKSTEPPERADAPTER_H_HEADER_INCLUDED_C1E77191
18 #define QMITKSTEPPERADAPTER_H_HEADER_INCLUDED_C1E77191
19 
21 #include "itkCommand.h"
22 #include "itkObject.h"
23 #include "mitkStepper.h"
24 #include "qobject.h"
25 
26 //##Documentation
27 //## @brief Helper class to connect Qt-based navigators to instances of Stepper
28 //##
29 //## The constructor has to be provided with the \a Navigator
30 //## that wants to use the \a Stepper. The \a Navigator has to define the
31 //## slots \a Refetch() and \a SetStepper(mitk::Stepper *). \a SetStepper will be
32 //## called only once to pass the \a Stepper to the \a Navigator. When the values of
33 //## the \a Stepper changes, \a Refetch() will be called. The \a Navigator can than
34 //## ask the \a Stepper for its new values.
35 //## \warning The \a Navigator has to be aware that it might have caused the changes
36 //## of the \a Stepper itself. So take care that no infinite recursion is created!
37 //## @ingroup NavigationControl
39 {
40  Q_OBJECT
41 public:
42  QmitkStepperAdapter(QObject *navigator, mitk::Stepper *stepper, const char *name);
43  virtual ~QmitkStepperAdapter();
44 
45  void SetStepper(mitk::Stepper *stepper)
46  {
47  this->SendStepper(stepper);
48  this->Refetch();
49  }
50 
51  class MITKQTWIDGETSEXT_EXPORT ItkEventListener : public itk::Command
52  {
53  public:
56  : m_Receiver(receiver){
57 
58  };
59  virtual void Execute(itk::Object *, const itk::EventObject &) override { emit m_Receiver->Refetch(); };
60  virtual void Execute(const itk::Object *, const itk::EventObject &) override { emit m_Receiver->Refetch(); };
61  protected:
62  QmitkStepperAdapter *m_Receiver;
63  };
64 
65 signals:
66  void signal_dummy();
67  void Refetch();
68  void SendStepper(mitk::Stepper *);
69 
70 protected:
74 
76 };
77 
78 #endif
ItkEventListener(QmitkStepperAdapter *receiver)
itk::SmartPointer< Self > Pointer
void SetStepper(mitk::Stepper *stepper)
#define MITKQTWIDGETSEXT_EXPORT
Helper class to connect Qt-based navigators to instances of Stepper.
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:53
mitk::Stepper::Pointer m_Stepper
virtual void Execute(itk::Object *, const itk::EventObject &) override
Helper class to step through a list.
Definition: mitkStepper.h:51
ItkEventListener::Pointer m_ItkEventListener