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