gtk3theme: Flush PlatformTheme palette on ColorScheme change
System color palette only takes the ColorScheme (Bright/Dark) into account during creation, which results in static color palette which does not reflect changes requested by `updateColorScheme`. Reinitialize the platform system color palette when ColorScheme is changed. Change-Id: I3f8f77a5990bda0f2db744f6ee8c6b392dfe8a84 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
caa0aa3fb4
commit
0dab50a124
@ -376,7 +376,8 @@ QPlatformThemePrivate::QPlatformThemePrivate()
|
|||||||
|
|
||||||
QPlatformThemePrivate::~QPlatformThemePrivate()
|
QPlatformThemePrivate::~QPlatformThemePrivate()
|
||||||
{
|
{
|
||||||
delete systemPalette;
|
if (systemPalette)
|
||||||
|
delete systemPalette;
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_GUI_EXPORT QPalette qt_fusionPalette()
|
Q_GUI_EXPORT QPalette qt_fusionPalette()
|
||||||
@ -476,8 +477,22 @@ Qt::ColorScheme QPlatformTheme::colorScheme() const
|
|||||||
void QPlatformTheme::requestColorScheme(Qt::ColorScheme scheme)
|
void QPlatformTheme::requestColorScheme(Qt::ColorScheme scheme)
|
||||||
{
|
{
|
||||||
Q_UNUSED(scheme);
|
Q_UNUSED(scheme);
|
||||||
|
Q_D(QPlatformTheme);
|
||||||
|
if (d->systemPalette) {
|
||||||
|
delete d->systemPalette;
|
||||||
|
d->systemPalette = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\internal
|
||||||
|
\brief Return a color palette for type \a type.
|
||||||
|
|
||||||
|
When relying on system color palette keep in mind that it is
|
||||||
|
lazily initialized and cached. If it needs to be updated
|
||||||
|
(i.e. due to ColorScheme changes), it's up to the caller
|
||||||
|
to take care of it. See \c requestColorScheme.
|
||||||
|
*/
|
||||||
const QPalette *QPlatformTheme::palette(Palette type) const
|
const QPalette *QPlatformTheme::palette(Palette type) const
|
||||||
{
|
{
|
||||||
Q_D(const QPlatformTheme);
|
Q_D(const QPlatformTheme);
|
||||||
|
@ -165,6 +165,7 @@ void QGtk3Theme::requestColorScheme(Qt::ColorScheme scheme)
|
|||||||
return;
|
return;
|
||||||
qCDebug(lcQGtk3Interface) << scheme << "has been requested. Theme supports color scheme:"
|
qCDebug(lcQGtk3Interface) << scheme << "has been requested. Theme supports color scheme:"
|
||||||
<< m_storage->colorScheme();
|
<< m_storage->colorScheme();
|
||||||
|
QPlatformTheme::requestColorScheme(scheme);
|
||||||
m_requestedColorScheme = scheme;
|
m_requestedColorScheme = scheme;
|
||||||
m_storage->handleThemeChange();
|
m_storage->handleThemeChange();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user