Limit QEvent::ApplicationPaletteChange casing to Mac

This is not needed on Linux and dramatically slows down runtime mode
change
This commit is contained in:
Juergen Spitzmueller 2023-06-11 12:43:30 +02:00
parent 3af906e9f3
commit 833f8c148e

View File

@ -1745,14 +1745,6 @@ bool GuiView::event(QEvent * e)
return QMainWindow::event(e);
}
case QEvent::ApplicationPaletteChange: {
// runtime switch from/to dark mode (Mac OS)
// We need to update metrics here to avoid a crash (#12786)
theBufferList().changed(true);
refillToolbars();
return QMainWindow::event(e);
}
case QEvent::Gesture: {
QGestureEvent *ge = static_cast<QGestureEvent*>(e);
QGesture *gp = ge->gesture(Qt::PinchGesture);
@ -1774,8 +1766,20 @@ bool GuiView::event(QEvent * e)
return QMainWindow::event(e);
}
// dark/light mode runtime switch support, OS-dependent.
// 1. Mac OS X
// Limit to Q_OS_MAC as this unnecessarily would also
// trigger on Linux with grave performance issues
#ifdef Q_OS_MAC
case QEvent::ApplicationPaletteChange: {
// We need to update metrics here to avoid a crash (#12786)
theBufferList().changed(true);
refillToolbars();
return QMainWindow::event(e);
}
#endif
// 2. Linux
case QEvent::StyleChange: {
// This might be a change from dark to light mode (Linux)
// We need to update metrics here to avoid a crash (#12786)
theBufferList().changed(true);
return QMainWindow::event(e);