-
Bug
-
Resolution: Fixed
-
P2: Important
-
None
-
5.12.0, 5.12.1
-
None
-
Qt 5.12.1, Emscripten 1.38.21 and Firefox 65.0
QKeyEvent sends wrong key code for '-' and '_' in Firefox when in Chromium code is correct.
#include <QApplication> #include <QWidget> #include <QLabel> #include <QKeyEvent> #include <QString> #include <QObject> class Filter: public QObject { public: Filter(QObject *parent=nullptr): QObject(parent) { } protected: bool eventFilter(QObject *, QEvent *ev) override { if(ev->type()==QEvent::KeyPress) { QKeyEvent *kEv=static_cast<QKeyEvent*>(ev); l.setText(QString("You pressed key %1.\nQt::Key_Minus=%2").arg(kEv->key()).arg(Qt::Key_Minus)); l.show(); } return false; } private: QLabel l; }; int main(int argc, char *argv[]) { QApplication a(argc, argv); QWidget w; w.installEventFilter(new Filter(&w)); w.show(); return a.exec(); }