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

QLineEdit/QTextEdit doesn't receive keyPressEvent on N97

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 4.7.2
    • 4.6.2
    • None
    • OS: Windows 7, and I am using Nokia Qt SDK 1.0
    • 3bb3af84bef3c0472ca8ed0d5c6bb3c82320956d

    Description

      I have a custom widget which inherits from QLinedEdit, in this widget I override event(QEvent * event), keyPressEvent(QKeyEvent *event) and keyReleaseEvent(QKeyEvent *event ). When I debugged the code on N97 device, when I press any key on the keypad the events are delivered as follows:

      1. event(QEvent * events) gets called with event type set to KeyRelease.
      2. keyReleaseEvent(QKeyEvent *event ) gets called.
      and keyPressEvent was never called !!

      if I press Enter, BackSpace, action keys, left, right, down, up, the events are delivered as follows:
      1. event(QEvent * events) gets called with event type set to KeyPress.
      2. keyPressEvent(QKeyEvent *event ) gets called.
      3. event(QEvent * events) gets called with event type set to KeyRelease.
      4. keyReleaseEvent(QKeyEvent *event ) gets called.
      which is correct.

      #include <QKeyEvent>
      #include <QMessageBox>
      #include <QLineEdit>
      #include <QTextEdit>
      #include <QDebug>

      How to reproduce:
      class MyWidget : public QLineEdit

      { Q_OBJECT public: MyWidget(QWidget *parent=0); void keyPressEvent(QKeyEvent * event); void keyReleaseEvent(QKeyEvent * event ); bool event(QEvent *event); }

      ;

      MyWidget::MyWidget(QWidget *parent)
      :QLineEdit(parent)
      {
      setText("Hola");
      }

      void MyWidget::keyPressEvent(QKeyEvent *event)

      { QLineEdit::keyPressEvent(event); }

      void MyWidget::keyReleaseEvent(QKeyEvent *event )

      { QLineEdit::keyReleaseEvent(event); }

      bool MyWidget::event(QEvent *event ) {
      switch( event->type() )

      { case QEvent::KeyPress: QLineEdit::event(event); break; case QEvent::KeyRelease: QLineEdit::event(event); break; default: QLineEdit::event(event); }

      }

      The same problem appears if I inherits from the QTextEdit

      Attachments

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

        Activity

          People

            axisnokia axisnokia (Inactive)
            mahdi Mahdi Hijazi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes