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

[Reg: 5.5.1->5.6] Modifier state gets lost when pressing shortcut

    XMLWordPrintable

Details

    Description

      #include <QAction>
      #include <QApplication>
      #include <QDebug>
      #include <QWidget>
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
          QWidget w;
          auto action = new QAction(&w);
      #ifdef Q_OS_MAC
          action->setShortcut(QString::fromLatin1("Alt+Tab"));
      #else
          action->setShortcut(QString::fromLatin1("Ctrl+Tab"));
      #endif
          QObject::connect(action, &QAction::triggered, &w, []() { qDebug() << QApplication::keyboardModifiers(); });
          w.addAction(action);
      
          w.show();
      
          return a.exec();
      }
      

      Run the application and press & hold Opt,
      press and release tab while still holding Opt.

      Expected: QFlags<Qt::KeyboardModifiers>(AltModifier)
      Actual: QFlags<Qt::KeyboardModifiers>(NoModifier)

      Attachments

        Issue Links

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

          Activity

            People

              vestbo Tor Arne Vestbø
              con Eike Ziller
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes