Send QEvent::ThemeChange to QGuiApplication
Currently it's sent only to all windows. This is inconvenient when trying to use it with something that is not attached to a window, e.g. a tray icon. Change-Id: I774ee93918715a58f686e4f21ae7cdf2217ab5ab Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
c0e07cc3e2
commit
bc2ed77a72
@ -2079,6 +2079,10 @@ bool QGuiApplication::event(QEvent *e)
|
|||||||
postEvent(topLevelWindow, new QEvent(e->type()));
|
postEvent(topLevelWindow, new QEvent(e->type()));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case QEvent::ThemeChange:
|
||||||
|
for (auto *w : QGuiApplication::allWindows())
|
||||||
|
forwardEvent(w, e);
|
||||||
|
break;
|
||||||
case QEvent::Quit:
|
case QEvent::Quit:
|
||||||
// Close open windows. This is done in order to deliver de-expose
|
// Close open windows. This is done in order to deliver de-expose
|
||||||
// events while the event loop is still running.
|
// events while the event loop is still running.
|
||||||
@ -2795,9 +2799,10 @@ void QGuiApplicationPrivate::processThemeChanged(QWindowSystemInterfacePrivate::
|
|||||||
QIconPrivate::clearIconCache();
|
QIconPrivate::clearIconCache();
|
||||||
|
|
||||||
QEvent themeChangeEvent(QEvent::ThemeChange);
|
QEvent themeChangeEvent(QEvent::ThemeChange);
|
||||||
const QWindowList windows = tce->window ? QWindowList{tce->window} : window_list;
|
if (tce->window)
|
||||||
for (auto *window : windows)
|
QGuiApplication::sendSpontaneousEvent(tce->window, &themeChangeEvent);
|
||||||
QGuiApplication::sendSpontaneousEvent(window, &themeChangeEvent);
|
else
|
||||||
|
QGuiApplication::sendSpontaneousEvent(qGuiApp, &themeChangeEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGuiApplicationPrivate::handleThemeChanged()
|
void QGuiApplicationPrivate::handleThemeChanged()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user