Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-76881

Numeric keypad entry does not respect Num Lock state

    XMLWordPrintable

Details

    • Linux/X11

    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

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            liaqi Liang Qi
            jroehm Jason Roehm
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes