Sync implementation of QGuiApplication and QApplication setPalette
The two static setPalette methods in QApplication and QGuiApplication should have the same behavior in terms of what signals and events they emit. Change-Id: I54579d490e31f3783e2d4fea689ca799a070ff1d Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>bb10
parent
04f5008f51
commit
0a09a6341d
|
|
@ -3299,7 +3299,7 @@ void QGuiApplication::setPalette(const QPalette &pal)
|
|||
QCoreApplication::setAttribute(Qt::AA_SetPalette);
|
||||
|
||||
if (qGuiApp)
|
||||
emit qGuiApp->paletteChanged(*QGuiApplicationPrivate::app_pal);
|
||||
qGuiApp->d_func()->sendApplicationPaletteChange();
|
||||
}
|
||||
|
||||
void QGuiApplicationPrivate::applyWindowGeometrySpecificationTo(QWindow *window)
|
||||
|
|
@ -4101,7 +4101,6 @@ void QGuiApplicationPrivate::notifyThemeChanged()
|
|||
if (!testAttribute(Qt::AA_SetPalette)) {
|
||||
clearPalette();
|
||||
initPalette();
|
||||
emit qGuiApp->paletteChanged(*app_pal);
|
||||
sendApplicationPaletteChange();
|
||||
}
|
||||
if (!(applicationResourceFlags & ApplicationFontExplicitlySet)) {
|
||||
|
|
@ -4115,7 +4114,9 @@ void QGuiApplicationPrivate::notifyThemeChanged()
|
|||
void QGuiApplicationPrivate::sendApplicationPaletteChange(bool toAllWidgets, const char *className)
|
||||
{
|
||||
Q_UNUSED(toAllWidgets)
|
||||
Q_UNUSED(className)
|
||||
|
||||
if (!className)
|
||||
emit qGuiApp->paletteChanged(*QGuiApplicationPrivate::app_pal);
|
||||
|
||||
if (!is_app_running || is_app_closing)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1390,14 +1390,11 @@ void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char*
|
|||
hash->insert(className, pal);
|
||||
}
|
||||
|
||||
if (!className && (!QApplicationPrivate::sys_pal || !palette.isCopyOf(*QApplicationPrivate::sys_pal)))
|
||||
QCoreApplication::setAttribute(Qt::AA_SetPalette);
|
||||
|
||||
if (qApp)
|
||||
qApp->d_func()->sendApplicationPaletteChange(all, className);
|
||||
|
||||
if (!className && (!QApplicationPrivate::sys_pal || !palette.isCopyOf(*QApplicationPrivate::sys_pal))) {
|
||||
QCoreApplication::setAttribute(Qt::AA_SetPalette);
|
||||
emit qGuiApp->paletteChanged(*QGuiApplicationPrivate::app_pal);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
@ -4433,7 +4430,7 @@ void QApplicationPrivate::sendApplicationPaletteChange(bool toAllWidgets, const
|
|||
if (!is_app_running || is_app_closing)
|
||||
return;
|
||||
|
||||
QGuiApplicationPrivate::sendApplicationPaletteChange();
|
||||
QGuiApplicationPrivate::sendApplicationPaletteChange(toAllWidgets, className);
|
||||
|
||||
QEvent event(QEvent::ApplicationPaletteChange);
|
||||
const QWidgetList widgets = QApplication::allWidgets();
|
||||
|
|
|
|||
Loading…
Reference in New Issue