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

QDockWidget doesn't hide ampersands in window title on Windows



    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • None
    • 5.6.0, 5.6.1, 5.9.1
    • Widgets: Main Window
    • Bug affects: Windows 7 with Qt 5.6.1 and Qt 5.6.0.

      Doesn't affect (listing only what I have tested and found to work): XUbuntu 16.04, OSX 10.11
    • Vista Style/docked: 46eb7d6b70416d99fddcb5a3d59c478da6b36bea (qtbase/5.10, 11.10.2017, 510.0) e70230405dce5ac03817fc564a3a8ba5f208422a (qt/qtbase/wip/qt6)


      We create QDockWidgets and then use their toggleViewAction to populate a menu. For the menu, we want to include ampersands in the action text for the keyboard shortcuts. So we set the ampersands in the windowTitle of the QDockWidget. On OSX and Linux this works fine and the windowTitle ignores the ampersand when it is drawn onscreen. But on Windows the ampersands show up in the window title.

      Might be related to QTBUG-12547 but I couldn't find anything closer in the bug tracker and that was closed years ago.

      Attached is a Qt Creator project with the 20 or so lines of code needed to reproduce and some screenshots showing the & in the window title.


        1. AmpersandBugTest.zip
          5 kB
          Shawn Waldon
        2. Dockwidget_floating.png
          4 kB
          Shawn Waldon
        3. Dockwidget_internal.png
          11 kB
          Shawn Waldon
        4. main.cpp
          0.7 kB
          Carel Combrink
        5. QTBUG-54485_workaround.png
          4 kB
          Carel Combrink
        6. QTBUG-54485.png
          4 kB
          Carel Combrink

        Issue Links

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



              anwojcie Anna Wojciechowska
              mathturtle Shawn Waldon
              3 Vote for this issue
              8 Start watching this issue



                Gerrit Reviews

                  There are no open Gerrit changes