mirror of
https://github.com/citra-emu/citra.git
synced 2025-07-03 18:10:08 +00:00
20 lines
602 B
C++
20 lines
602 B
C++
#include <KeyPressEater.h>
|
|
#include <QKeyEvent>
|
|
#include <QLineEdit>
|
|
|
|
KeyPressEater::KeyPressEater(QObject* parent) : QObject(parent) {}
|
|
|
|
bool KeyPressEater::eventFilter(QObject *obj, QEvent *event) {
|
|
if (event->type() == QEvent::KeyPress) {
|
|
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
|
|
auto keyName = QKeySequence(keyEvent->key()).toString();
|
|
|
|
QLineEdit* lineEdit = static_cast<QLineEdit*>(obj);
|
|
lineEdit->setText(keyName);
|
|
return true;
|
|
}
|
|
else {
|
|
// standard event processing
|
|
return QObject::eventFilter(obj, event);
|
|
}
|
|
} |