Environment
Qt: v6.8.1 (mingw_64)
Windows 11
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.
[image: a6bfdc0a-d7a8-41a3-bddc-f7d2557fa88b.png]
Code
My code is recognized as spam and prohibited from posting here. I'll attach download link.
https://drive.google.com/file/d/18V_E4UvpG2e9h9MDhHR_YLOanw9t_leJ/view?usp=sharing
The key 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"));
}