BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
CustomEventFilters.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/utils/CustomEventFilters.h
6 //! @brief Defines classes releted to event filtering
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_GUI_COREGUI_UTILS_CUSTOMEVENTFILTERS_H
16 #define BORNAGAIN_GUI_COREGUI_UTILS_CUSTOMEVENTFILTERS_H
17 
18 #include <QObject>
19 
20 //! Filter out space bar key events, which is special case for dialog windows.
21 
22 class SpaceKeyEater : public QObject {
23  Q_OBJECT
24 public:
25  SpaceKeyEater(QObject* parent = 0);
26 
27 protected:
28  bool eventFilter(QObject* obj, QEvent* event);
29 };
30 
31 //! Event filter to install on combo boxes and spin boxes to not
32 //! to react on wheel events during scrolling of InstrumentComponentWidget.
33 
34 class WheelEventEater : public QObject {
35  Q_OBJECT
36 public:
37  WheelEventEater(QObject* parent = 0);
38 
39 protected:
40  bool eventFilter(QObject* obj, QEvent* event);
41 };
42 
43 //! Lisens for press-del-key events
44 
45 class DeleteEventFilter : public QObject {
46  Q_OBJECT
47 public:
48  DeleteEventFilter(QObject* parent = 0) : QObject(parent) {}
49 
50 protected:
51  bool eventFilter(QObject* dist, QEvent* event);
52 
53 signals:
54  void removeItem();
55 };
56 
57 //! Event filter to prevent lost of focus by custom material editor.
58 
59 class LostFocusFilter : public QObject {
60  Q_OBJECT
61 public:
62  LostFocusFilter(QObject* parent = 0);
63 
64 protected:
65  bool eventFilter(QObject* obj, QEvent* event);
66 };
67 
68 //! Event filter for global tracking of shortcodes.
69 
70 class ShortcodeFilter : public QObject {
71  Q_OBJECT
72 public:
73  ShortcodeFilter(const QString& shortcode, QObject* parent = 0);
74 
75 signals:
76  void found();
77 
78 protected:
79  bool eventFilter(QObject* obj, QEvent* event);
80  QString m_shortcode;
81  int m_index;
82 };
83 
84 //! Filter out right mouse button events.
85 
86 class RightMouseButtonEater : public QObject {
87  Q_OBJECT
88 public:
89  RightMouseButtonEater(QObject* parent = 0);
90 
91 protected:
92  bool eventFilter(QObject* obj, QEvent* event);
93 };
94 
95 //! Propagate tab events from focusProxy to parent.
96 
97 class TabFromFocusProxy : public QObject {
98  Q_OBJECT
99 public:
100  TabFromFocusProxy(QWidget* parent = 0);
101 
102 protected:
103  bool eventFilter(QObject* obj, QEvent* event);
104  QWidget* m_parent;
105 };
106 
107 #endif // BORNAGAIN_GUI_COREGUI_UTILS_CUSTOMEVENTFILTERS_H
Lisens for press-del-key events.
bool eventFilter(QObject *dist, QEvent *event)
DeleteEventFilter(QObject *parent=0)
Event filter to prevent lost of focus by custom material editor.
LostFocusFilter(QObject *parent=0)
bool eventFilter(QObject *obj, QEvent *event)
Filter out right mouse button events.
bool eventFilter(QObject *obj, QEvent *event)
RightMouseButtonEater(QObject *parent=0)
Event filter for global tracking of shortcodes.
bool eventFilter(QObject *obj, QEvent *event)
ShortcodeFilter(const QString &shortcode, QObject *parent=0)
Filter out space bar key events, which is special case for dialog windows.
SpaceKeyEater(QObject *parent=0)
bool eventFilter(QObject *obj, QEvent *event)
Propagate tab events from focusProxy to parent.
bool eventFilter(QObject *obj, QEvent *event)
TabFromFocusProxy(QWidget *parent=0)
Passing focus-related events from child widget (e.g.
Event filter to install on combo boxes and spin boxes to not to react on wheel events during scrollin...
WheelEventEater(QObject *parent=0)
bool eventFilter(QObject *obj, QEvent *event)