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

Mnemonics are not displayed correctly in basic Qt widgets.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 6.9.1
    • None
    • Windows 10, Windows 11
      Processor: 12th Gen Intel(R) Core(TM) i5-1235U 1.30 GHz
    • Windows

      Problem:

      Mnemonics are not displayed after 'Alt' key press in basic Qt widgets. They appear when you put mouse over them, and never disappear. I saw some other different mnemonics bugs for version Qt 4.x and 5.x, and some problems still occur in newest Qt Creator 17.0 and Qt 6.9.1 (MSVC 2022, x86_64) version.

       

      How to reproduce it:

      1. Create basic window application with 3 buttons, where each of them have assign mnemonic.
      2. Put mouse somewhere on frame and press any mnemonic shortcut
      3. Underscore sign should appear under each mnemonic letter to inform user about available shortcuts, but nothing such happen.
      4. Even if you use previous define shortcut e.g. 'Alt' + 'O' for Open, mnemonic appear, but then never disappear.

       

      Hints and tips:

      Take a look on my minimal reproducible example, which I attached to this ticket. When you uncomment function repaint() in MainWindow::keyPressEvent, you should solve the first error, but the same approach in MainWindow::keyReleaseEvent doen't hide the mnemonics on QPushButtons. Alt modifiers look and behave fine, so probably, state is not correctly propagate to widgets in QWindow. 

        1. mainwindow.ui
          0.7 kB
          Hubert Nowak
        2. main.cpp
          3 kB
          Hubert Nowak
        3. CMakeLists.txt
          2 kB
          Hubert Nowak
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            srutledg Shawn Rutledge
            hubert_nowak Hubert Nowak
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes