19 lines
534 B
C++
19 lines
534 B
C++
//
|
|
// Created by grimmauld on 07.03.24.
|
|
//
|
|
|
|
#include <QKeyEvent>
|
|
#include "KeyHandler.h"
|
|
|
|
bool KeyHandler::eventFilter(QObject *obj, QEvent *event) {
|
|
if (event->type() == QEvent::KeyPress) {
|
|
auto *key = dynamic_cast<QKeyEvent *>(event);
|
|
|
|
return std::any_of(listeners.cbegin(), listeners.cend(),
|
|
[key](auto* listener) {
|
|
return listener->testAndInvoke(key);
|
|
});
|
|
} else {
|
|
return QObject::eventFilter(obj, event);
|
|
}
|
|
} |