NorMIT-nav  18.04-rc6
An IGT application
cxRequestEnterStateTransition.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 #ifndef CXREQUESTENTERSTATETRANSITION_H_
13 #define CXREQUESTENTERSTATETRANSITION_H_
14 
15 #include "cxResourceExport.h"
16 
17 #include <QEvent>
18 #include <QAbstractTransition>
19 
20 namespace cx
21 {
31 struct cxResource_EXPORT RequestEnterStateEvent: public QEvent
32 {
33  RequestEnterStateEvent(const QString &stateUid) :
34  QEvent(QEvent::Type(QEvent::User + 1)), mStateUid(stateUid)
35  {}
36 
37  QString mStateUid;
38 };
39 
45 class cxResource_EXPORT RequestEnterStateTransition: public QAbstractTransition
46 {
47 public:
48  RequestEnterStateTransition(const QString &stateUid) :
49  mStateUid(stateUid)
50  {}
51 
52 protected:
53  virtual bool eventTest(QEvent *e)
54  {
55  if (e->type() != QEvent::Type(QEvent::User + 1)) // StringEvent
56  return false;
57  RequestEnterStateEvent *se = static_cast<RequestEnterStateEvent*>(e);
58  return (mStateUid == se->mStateUid);
59  }
60 
61  virtual void onTransition(QEvent *)
62  {}
63 
64 private:
65  QString mStateUid;
66 };
67 
71 } //namespace cx
72 #endif /* CXREQUESTENTERSTATETRANSITION_H_ */
Utility class for StateService states.
RequestEnterStateTransition(const QString &stateUid)
RequestEnterStateEvent(const QString &stateUid)
Utility class for StateService states.
Namespace for all CustusX production code.