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

QLabel underline for accelerator doesn't update when Alt is pressed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4: Low P4: Low
    • None
    • 6.8.2
    • None
    • Qt: v6.8.2 (mingw_64)
      Windows 11
    • Windows

      First reported here.

      Minimal Example

      Problem

      When the program is running, toggle "Underline keyboard short cuts and keys" in "Control Panel\Ease of Access\Ease of Access Center\Make the keyboard easier to use". The label doesn't update the underline, until the program is exited and restarted. QMenu can update this without restarting the program. Probably QLabel doesn't have a slot to update display when this system setting changes.
      (See attached image.)

      Code

      Attached below. The core part is

      MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
      {
          lineEdit1 = new QLineEdit;
          lineEdit2 = new QLineEdit;
      
          // bug: QLabel underline for accelerator doesn't update when Alt is pressed in Windows
          label1 = new QLabel(tr("Field &A:"));
          label1->setBuddy(lineEdit1);
      
          label2 = new QLabel(tr("Field &B:"));
          label2->setBuddy(lineEdit2);
      
          QWidget *centralWidget = new QWidget;
          setCentralWidget(centralWidget);
      
          QGridLayout *mainLayout = new QGridLayout(centralWidget);
          mainLayout->addWidget(label1, 0, 0);
          mainLayout->addWidget(lineEdit1, 0, 1);
          mainLayout->addWidget(label2, 1, 0);
          mainLayout->addWidget(lineEdit2, 1, 1);
      
          menuBar()->addMenu(tr("&Menu"));
      }
      

        1. snippet.png
          snippet.png
          3 kB
        2. alt_example.zip
          2 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            yuanxun Xun Yuan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes