NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
niftkWheelEventEater.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 niftkWheelEventEater_h
16 #define niftkWheelEventEater_h
17 
18 #include "niftkCoreGuiExports.h"
19 #include <QWidget>
20 #include <QEvent>
21 
22 namespace niftk
23 {
24 
27 class NIFTKCOREGUI_EXPORT WheelEventEater : public QObject
28 {
29  Q_OBJECT
30 
31 public:
32  WheelEventEater(QWidget* parent=NULL) : QObject(parent) { m_IsEating = true; }
34  void SetIsEating(bool b) { m_IsEating = b; }
35  bool GetIsEating() const { return m_IsEating; }
36 protected:
37  virtual bool eventFilter(QObject *obj, QEvent *event) override
38  {
39  if (m_IsEating && event->type() == QEvent::Wheel)
40  {
41  return true;
42  } else
43  {
44  // standard event processing
45  return QObject::eventFilter(obj, event);
46  }
47  }
48 private:
49  bool m_IsEating;
50 };
51 
52 }
53 
54 #endif
~WheelEventEater()
Definition: niftkWheelEventEater.h:33
GLdouble GLdouble GLdouble b
Definition: glew.h:7885
GLhandleARB obj
Definition: glew.h:5177
WheelEventEater(QWidget *parent=NULL)
Definition: niftkWheelEventEater.h:32
bool GetIsEating() const
Definition: niftkWheelEventEater.h:35
virtual bool eventFilter(QObject *obj, QEvent *event) override
Definition: niftkWheelEventEater.h:37
Qt event filter to eat wheel events.
Definition: niftkWheelEventEater.h:27
cl_event event
Definition: glew.h:3231
void SetIsEating(bool b)
Definition: niftkWheelEventEater.h:34
Definition: niftkExceptionObject.h:21