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
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3bb055d8ab045def265bb9b3eb4e7dff1874a093)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Giuseppe D'Angelo 2022-12-13 17:57:34 +01:00 committed by Qt Cherry-pick Bot
parent 4b40d70700
commit ffe98c9b51

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);
}