NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
niftkMouseEventEater.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  NifTK: A software platform for medical image computing.
4 
5  Copyright (c) University College London (UCL). All rights reserved.
6 
7  This software is distributed WITHOUT ANY WARRANTY; without even
8  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  PURPOSE.
10 
11  See LICENSE.txt in the top level directory for details.
12 
13 =============================================================================*/
14 
15 #ifndef niftkMouseEventEater_h
16 #define niftkMouseEventEater_h
17 
18 #include "niftkCoreGuiExports.h"
19 #include <QWidget>
20 #include <QEvent>
21 
22 namespace niftk
23 {
24 
28 class NIFTKCOREGUI_EXPORT MouseEventEater : public QObject
29 {
30  Q_OBJECT
31 
32 public:
33  MouseEventEater(QWidget* parent=NULL)
34  : QObject(parent)
35  {
36  m_IsEating = true;
37  }
39  {
40  }
41  void SetIsEating(bool b)
42  {
43  m_IsEating = b;
44  }
45  bool GetIsEating() const
46  {
47  return m_IsEating;
48  }
49 protected:
50  virtual bool eventFilter(QObject *obj, QEvent *event) override
51  {
52  if (m_IsEating &&
53  ( event->type() == QEvent::MouseButtonDblClick
54  || event->type() == QEvent::MouseButtonPress
55  || event->type() == QEvent::MouseButtonRelease
56  || event->type() == QEvent::MouseMove
57  || event->type() == QEvent::MouseTrackingChange
58  )) {
59  return true;
60  } else {
61  // standard event processing
62  return QObject::eventFilter(obj, event);
63  }
64  }
65 private:
66  bool m_IsEating;
67 };
68 
69 }
70 
71 #endif
virtual bool eventFilter(QObject *obj, QEvent *event) override
Definition: niftkMouseEventEater.h:50
Qt event filter to eat mouse events ....
Definition: niftkMouseEventEater.h:28
MouseEventEater(QWidget *parent=NULL)
Definition: niftkMouseEventEater.h:33
GLdouble GLdouble GLdouble b
Definition: glew.h:7885
void SetIsEating(bool b)
Definition: niftkMouseEventEater.h:41
GLhandleARB obj
Definition: glew.h:5177
~MouseEventEater()
Definition: niftkMouseEventEater.h:38
cl_event event
Definition: glew.h:3231
bool GetIsEating() const
Definition: niftkMouseEventEater.h:45
Definition: niftkExceptionObject.h:21