Vladimir Minenko(deleted)
|
Re: Keyboard capture : modifiers & keypad
|
Vladimir Minenko(deleted)
07/09/2014 9:16 AM
post110994
|
Re: Keyboard capture : modifiers & keypad
I've just made a simple test app based on a widget template project which filters all key events and also processes all
events in the usual way. I've tested it on imx6 sabrelite with the apps and media sample OS image, a US usb keyboard
attached and with Qt 5.3.1. All keys incl. modifies are reported as expected.
Not sure if it is about a different keyboard layout or a driver... This escapes my QNX knowledge, but this is not a
generic issue in Qt on QNX, unless it is a broken Qt build
{code}
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
installEventFilter(this);
}
bool MainWindow::eventFilter(QObject *obj, QEvent *event)
{
if (event->type() == QEvent::KeyPress) {
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
qDebug("Filered a key press %d", keyEvent->key());
return false; // keep in the loop for further processing
} else {
// standard event processing
return QObject::eventFilter(obj, event);
}
}
void MainWindow::keyPressEvent(QKeyEvent *event)
{
qDebug("Key event received:");
qDebug() << "\tno modifier pressed: " << event->modifiers().testFlag(Qt::NoModifier);
qDebug() << "\tkey: " << event->key();
}
MainWindow::~MainWindow()
{
delete ui;
}
{code}
|
|
|