Fix potential problems with code related to styling the tray menu
This commit is contained in:
parent
3fc7fbd542
commit
cc599efbef
|
@ -149,7 +149,9 @@ void TrayMenu::setWindowType(WindowType windowType)
|
||||||
if (m_isWindows11Style) {
|
if (m_isWindows11Style) {
|
||||||
updateContentMargins();
|
updateContentMargins();
|
||||||
if (windowType == WindowType::Popup) {
|
if (windowType == WindowType::Popup) {
|
||||||
style()->polish(this);
|
if (auto *const s = style()) {
|
||||||
|
s->polish(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -230,9 +232,9 @@ void TrayMenu::paintEvent(QPaintEvent *event)
|
||||||
QMenu::paintEvent(event);
|
QMenu::paintEvent(event);
|
||||||
} else {
|
} else {
|
||||||
#ifdef TRAY_MENU_HANDLE_WINDOWS11_STYLE
|
#ifdef TRAY_MENU_HANDLE_WINDOWS11_STYLE
|
||||||
const auto p = m_windowType != TrayMenu::WindowType::Popup && m_isWindows11Style ? QGuiApplication::palette() : palette();
|
const auto p = m_windowType != TrayMenu::WindowType::Popup && m_isWindows11Style ? QGuiApplication::palette() : QPalette(palette());
|
||||||
#else
|
#else
|
||||||
const auto p = palette();
|
const auto &p = palette();
|
||||||
#endif
|
#endif
|
||||||
QPainter(this).fillRect(event->rect(), p.color(backgroundRole()));
|
QPainter(this).fillRect(event->rect(), p.color(backgroundRole()));
|
||||||
QWidget::paintEvent(event);
|
QWidget::paintEvent(event);
|
||||||
|
|
Loading…
Reference in New Issue