BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
SpaceKeyEater Class Reference

Description

Filter out space bar key events, which is special case for dialog windows.

Definition at line 22 of file CustomEventFilters.h.

Inheritance diagram for SpaceKeyEater:
[legend]
Collaboration diagram for SpaceKeyEater:
[legend]

Public Member Functions

 SpaceKeyEater (QObject *parent=nullptr)
 

Protected Member Functions

bool eventFilter (QObject *obj, QEvent *event) override
 

Constructor & Destructor Documentation

◆ SpaceKeyEater()

SpaceKeyEater::SpaceKeyEater ( QObject *  parent = nullptr)

Definition at line 22 of file CustomEventFilters.cpp.

23  : QObject(parent)
24 {
25 }

Member Function Documentation

◆ eventFilter()

bool SpaceKeyEater::eventFilter ( QObject *  obj,
QEvent *  event 
)
overrideprotected

Definition at line 27 of file CustomEventFilters.cpp.

28 {
29  if (event->type() != QEvent::KeyPress)
30  return QObject::eventFilter(obj, event);
31 
32  auto* keyEvent = dynamic_cast<QKeyEvent*>(event);
33  if (keyEvent->key() == Qt::Key_Space)
34  return true; /* Always accept space bar */
35  return QObject::eventFilter(obj, event);
36  // standard event processing
37 }

The documentation for this class was generated from the following files: