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

Dead keys don't generate a keyPressed event on linux

    XMLWordPrintable

Details

    • Linux/X11

    Description

      Pressing a dead key (for example ^) does not generate any keypress event but generates a keyrelease one.

      The following example shows the issue pretty well. When pressing ^ and then e, I'm getting both keyreleases and a ê appears in the QLineEdit. I would expect Qt not to eat the keypress event. (Same thing happens without the QLineEdit).

      #include <QApplication>
      #include <QKeyEvent>
      #include <QLineEdit>
      #include <QWidget>
      #include <QtGui>
      
      class KeyPress : public QWidget
      {
          Q_OBJECT
      public:
          KeyPress(QWidget *parent = nullptr) : QWidget(parent) { new QLineEdit(this); }
      
      protected:
          void keyPressEvent(QKeyEvent *event) override final
          {
              qDebug() << "press" << event->key() << event->text();
          }
          void keyReleaseEvent(QKeyEvent *event) override final
          {
              qDebug() << "release" << event->key() << event->text();
          }
      };
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);    
          KeyPress *keyPress = new KeyPress();
          keyPress->show();
          return a.exec();
      }
      

       Is there any way to actually get those keypress events ? Is this maybe considered a normal behavior ?

      Attachments

        Issue Links

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

          Activity

            People

              srutledg Shawn Rutledge
              borivel Bastien Orivel
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes