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

Keyboard modifiers do not work in keyPressEvent

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 5.2.0
    • None
    • Windows 8 x64
      Qt 5.2.0 x64

    Description

      void Editor::keyPressEvent(QKeyEvent *event)
      {
          Qt::KeyboardModifiers keyMod = QApplication::keyboardModifiers();
          bool isCtrl = keyMod.testFlag(Qt::ControlModifier);
          bool isAlt = keyMod.testFlag(Qt::AltModifier);
          bool isShift = keyMod.testFlag(Qt::ShiftModifier);
          
          qDebug()<<isCtrl;    
      }
      

      above code worked fine in Qt 5.1.1 but in Qt 5.2.0 isCtrl, isAlt, isShift is always set to false.

      Attachments

        Issue Links

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

          Activity

            People

              Unassigned Unassigned
              markac Maria Kaczynska
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes