Details
-
Bug
-
Resolution: Won't Do
-
P2: Important
-
None
-
5.12.3, 5.12.4
-
None
-
Ubuntu 18.04
Description
After upgrading my application from the 5.9.x release series to 5.12.4, I found that keyboard input using the numeric keypad does not respect the Num Lock state. Specifically, the QKeyEvents that are passed to QWidget::keyPressEvent() always contain a key() value that represents the key's meaning when Num Lock is off (for instance, pressing the 9 key always sends a Key_PageUp event, regardless of the state of Num Lock).
This is a little similar to a previous bug in 5.1.0: https://bugreports.qt.io/browse/QTBUG-32687. The same test program provided there suffices to duplicate the issue:
Built with: g++ -o test test.cpp $(pkg-config --cflags --libs Qt5Core Qt5Gui Qt5Widgets) -fPIC
#include <QApplication>
#include <QDoubleSpinBox>
#include <QMainWindow>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QMainWindow w;
w.setCentralWidget(new QDoubleSpinBox(&w));
w.show();
return a.exec();
}
This will open a window with a QDoubleSpinBox in it. Try using the numeric keypad to enter a value into it and you'll find that the keys all act as arrow/navigation keys, no matter whether Num Lock is on or off.
There was a similar report with Qt 5.12 here: https://forum.freecadweb.org/viewtopic.php?style=3&f=4&t=35102