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