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

Cannot handle QKeyEvent normally in QPlainText KeyPressEvent

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P3: Somewhat important
    • None
    • 5.6.3, 5.15.1, 5.15.2
    • None
    • Windows

    Description

      I inherited QPlainTextEdit and reimplement KeyPressEvent(QKeyEvent) to print info.

       

      void PlainTextEdit::keyPressEvent(QKeyEvent *e)
      {
          qDebug()<< "-------------PlainTextEdit--------------";
          qDebug()<< "QKeyEvent Text:"<<e->text();
          qDebug()<< "QKeyEvent Count:"<<e->count();
          qDebug()<< "QKeyEvent isAutoRepeat:"<<e->isAutoRepeat();
          if(e->modifiers().testFlag(Qt::ShiftModifier)){qDebug()<<"QKeyEvent modifier:"<<"ShiftModifier";}
          qDebug()<< "QKeyEvent key:"<<e->key();
          return QPlainTextEdit::keyPressEvent(e);
      }
      
      

      bug trigger step:

      1.press shift and don't release,the key keyPressEvent will be called.

      2.press $ (which is 4 without shift, same as other numbers key) ,then haven't call keyPressEvent ,the PlainTextEdit shows a  $.

      Press shift  twice in a row ,then press shift and number key (not at the Numeric keypad), the key keyPressEvent will be called normally.Then press shift twice in a row,it will back to the wrong status.

       

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            chenghongfeng 程 洪峰
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes