Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.4.0, 6.4.1
-
None
-
-
3bb055d8a (dev), 9af5ed3a8 (6.4), ffe98c9b5 (6.5)
Description
If a QProxyStyle (or derived class) is set on QApplication, some widgets (QPushButton, QCheckBox) no longer have a focus frame when they are focused (on macOS).
With Qt 6.3.2, or if the style is directly set on the widget everything is ok.
I guess the problem was introduced with this commit:
https://code.qt.io/cgit/qt/qtbase.git/commit/?id=5d8a7652b995124495ef4f4a43fd8cf461367d62
int main(int argc, char *argv[]) { QApplication a(argc, argv); // as soon as QProxyStyle (or derived class) is set on QApplication // some widgets no longer have a focus ring a.setStyle(new QProxyStyle); QWidget *w = new QWidget; w->setLayout(new QHBoxLayout(w)); w->layout()->addWidget(new QPushButton("PushButton", w)); w->layout()->addWidget(new QCheckBox("CheckBox", w)); w->show(); return a.exec(); }
Important note:
Keyboard navigation is disabled on macOS by default. You have to enable it, otherwise buttons won't get focused at all when pressing TAB.
macOS 13: System Settings -> Keyboard -> Keyboard navigation
macOS <=12: System Settings -> Keyboard -> Shortcuts -> Use keyboard navigation to move focus...