Fix the focus frame on Mac

The Mac style uses focus in/out events (sent by QApplication) in order
to update the focus frame. If a proxy style is installed, these events
never reach the Mac style object.

Amends 5d8a7652b995124495ef4f4a43fd8cf461367d62 , by making the
forwarding limited to the events for which we want it to happen, and not
just *any* event.

Fixes: QTBUG-109375
Change-Id: I6df49aa81d6ebb8dbaf00b9ba99e2a7c006e1181
Pick-to: 6.4 6.5
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Giuseppe D'Angelo 2022-12-13 17:57:34 +01:00
parent cc9144b4f3
commit 3bb055d8ab

View File

@ -348,7 +348,18 @@ void QProxyStyle::unpolish(QApplication *app)
*/
bool QProxyStyle::event(QEvent *e)
{
// ### Qt 7: remove this override
Q_D (QProxyStyle);
switch (e->type()) {
// The Mac style relies on these events in order to set the focus frame
case QEvent::FocusIn:
case QEvent::FocusOut:
d->ensureBaseStyle();
return QApplication::sendEvent(d->baseStyle, e);
default:
break;
}
return QCommonStyle::event(e);
}