macOS: Properly unpolish font and palette

Explicitly setting the application font and palette will actually
persist the current state of the application font and palette to
the widget, and it will stop reacting to system style changes.

Change-Id: Ib856fe86cd3edb618b7ee5819d6c6c892c61fd1d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
bb10
Tor Arne Vestbø 2019-06-26 12:56:12 +02:00
parent a96a64be2d
commit 857e4881c6
1 changed files with 5 additions and 6 deletions

View File

@ -2139,10 +2139,9 @@ void QMacStyle::unpolish(QWidget* w)
#if QT_CONFIG(menu)
qobject_cast<QMenu*>(w) &&
#endif
!w->testAttribute(Qt::WA_SetPalette)) {
QPalette pal = qApp->palette(w);
w->setPalette(pal);
w->setAttribute(Qt::WA_SetPalette, false);
!w->testAttribute(Qt::WA_SetPalette))
{
w->setPalette(QPalette());
w->setWindowOpacity(1.0);
}
@ -2158,9 +2157,9 @@ void QMacStyle::unpolish(QWidget* w)
#if QT_CONFIG(tabbar)
if (qobject_cast<QTabBar*>(w)) {
if (!w->testAttribute(Qt::WA_SetFont))
w->setFont(qApp->font(w));
w->setFont(QFont());
if (!w->testAttribute(Qt::WA_SetPalette))
w->setPalette(qApp->palette(w));
w->setPalette(QPalette());
}
#endif