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

Qt::AA_MacDontSwapCtrlAndMeta has no effect

    XMLWordPrintable

Details

    • macOS
    • b4869b8e9324c1614333066a6cc5d0df0d7b6af9

    Description

      Qt::AA_MacDontSwapCtrlAndMeta doesn't seem to swap the modifiers after all.

      The bug can be reproduced e.g with the 'font sampler' example.
      if one adds:

          app.setAttribute(Qt::AA_MacDontSwapCtrlAndMeta);
          app.installEventFilter(new EventFilter());
      

      and:

      class EventFilter : public QObject
      {
      protected:
          bool eventFilter(QObject *obj, QEvent *event)
          {
              if (event->type() == QEvent::KeyPress) {
                  QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
                  Qt::KeyboardModifiers modifiers = keyEvent->modifiers();
                  if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta))
                      qDebug() << modifiers;
              return QObject::eventFilter(obj, event);
          }
      }
      };
      

      Run the example and do select with:

      • cmd + mouse press (it still shows that the control modifier was pressed)
      • ctrl + mouse press (it still shows the the meta modifier was pressed)

      So, it still swaps the modifiers even AA_MacDontSwapCtrlAndMeta is set.

      Attachments

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

        Activity

          People

            sorvig Morten Sørvig
            mipohjan Milla Pohjanheimo
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes