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

A string of multiple ampersands treated unexpectedly by menubar/menu on macOS

    XMLWordPrintable

Details

    • macOS
    • 2c062546a21edc68ded82b7b852df3c993d332e0

    Description

      On macOS: If the text of a QAction contains multiple ampersands in a row only the first ampersand is removed as the text appears in the main menu. This behavior differs from how Windows handles ampersand in the same situation. On windows every other ampersand is removed. This is also how other widgets that utilize QActions and shortcuts, such as tabs, buttons etc., handle a string of multiple ampersands.

      For example, this is how a string containing six ampersands in a row is handled:

      Shortcut-utilizing widgets generally: &&&&&& -> &&&
      QMenuBar/QMenu on Windows: &&&&&& -> &&&
      QMenubar/QMenu on macOS: &&&&&& -> &&&&&

      Steps to reproduce:

      • Run the sample attached
      • Click on the 'Test Menu' in the menu bar
      • Look at the menu item revealed and compare the ampersand handling across the different widgets. (See the image attached)
        EXPECTED: The menu item reads "One & , two && , three &&& , four , &&&& stop"
        ACTUAL: The menu item reads "One & , two &&& , three &&&&& , four , &&&&&&& stop"

      Attachments

        1. qtbug63361.zip
          2 kB
        2. qtbug63361.png
          qtbug63361.png
          57 kB

        Issue Links

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

          Activity

            People

              anrocha André De La Rocha (Inactive)
              risto.sipola Risto Sipola
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes