Medical Imaging Interaction Toolkit  2018.4.99-389bf124
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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef QMITKSTEPPERADAPTER_H_HEADER_INCLUDED_C1E77191
14 #define QMITKSTEPPERADAPTER_H_HEADER_INCLUDED_C1E77191
15 
17 #include "itkCommand.h"
18 #include "itkObject.h"
19 #include "mitkStepper.h"
20 #include "qobject.h"
21 
22 //##Documentation
23 //## @brief Helper class to connect Qt-based navigators to instances of Stepper
24 //##
25 //## The constructor has to be provided with the \a Navigator
26 //## that wants to use the \a Stepper. The \a Navigator has to define the
27 //## slots \a Refetch() and \a SetStepper(mitk::Stepper *). \a SetStepper will be
28 //## called only once to pass the \a Stepper to the \a Navigator. When the values of
29 //## the \a Stepper changes, \a Refetch() will be called. The \a Navigator can than
30 //## ask the \a Stepper for its new values.
31 //## \warning The \a Navigator has to be aware that it might have caused the changes
32 //## of the \a Stepper itself. So take care that no infinite recursion is created!
33 //## @ingroup NavigationControl
35 {
36  Q_OBJECT
37 public:
38  QmitkStepperAdapter(QObject *navigator, mitk::Stepper *stepper, const char *name);
39  ~QmitkStepperAdapter() override;
40 
41  void SetStepper(mitk::Stepper *stepper)
42  {
43  this->SendStepper(stepper);
44  this->Refetch();
45  }
46 
47  class MITKQTWIDGETSEXT_EXPORT ItkEventListener : public itk::Command
48  {
49  public:
52  : m_Receiver(receiver){
53 
54  };
55  void Execute(itk::Object *, const itk::EventObject &) override { emit m_Receiver->Refetch(); };
56  void Execute(const itk::Object *, const itk::EventObject &) override { emit m_Receiver->Refetch(); };
57  protected:
59  };
60 
61 signals:
62  void signal_dummy();
63  void Refetch();
64  void SendStepper(mitk::Stepper *);
65 
66 protected:
70 
71  ItkEventListener::Pointer m_ItkEventListener;
72 };
73 
74 #endif
ItkEventListener(QmitkStepperAdapter *receiver)
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:49
void Execute(itk::Object *, const itk::EventObject &) override
mitk::Stepper::Pointer m_Stepper
Helper class to step through a list.
Definition: mitkStepper.h:47
ItkEventListener::Pointer m_ItkEventListener