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

QShortcut::activatedAmbiguously does not behave as documented

    XMLWordPrintable

Details

    Description

      The documentation at QShortcut::activatedAmbiguously documentation states that if a shortcut is pressed which is also the start of another shortcut, 'activatedAmbiguously' is emitted and 'activated' is not emitted.

      However, this is not the case. The attached reproducer defines the key sequence "Tab" and the key sequence "Tab+Backspace". If it is run and the user presses "Tab", 'activated' is emitted. According to the documentation, 'activatedAmbiguously' should be emitted.

      The reason is found in the source code. QShortcutMap::dispatchEvent at qshortcutmap.cpp:620 only considers 'identicals', i.e. key sequences which are identical to the key sequence pressed by the user. The list of 'identicals' is built in QShortcutMap::find in qshortcutmap.cpp:458 where also the comment can be found "// We don't need partials, if we have identicals" in line 462. To do ambiguity handling, the partials are needed, even if we have 'identicals'.

      As this is very old code, I'd suggest to modify the documentation to match the code.

      Attachments

        1. main.cpp
          1.0 kB
        2. CMakeLists.txt
          0.5 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            srutledg Shawn Rutledge
            andreasbuhr Andreas Buhr
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes