Add deprecation warnings to QGuiApplication::fontChanged/paletteChanged

And silence those warnings in code that emits those signals.

Change-Id: Ic9013648060c9b84b59c44bb5a8c77e48f82d24f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Volker Hilsheimer 2020-06-08 21:16:10 +02:00 committed by Tor Arne Vestbø
parent 2a864a4f85
commit bb4402af2b
2 changed files with 8 additions and 2 deletions

View File

@ -3363,7 +3363,10 @@ void QGuiApplicationPrivate::handlePaletteChanged(const char *className)
{
if (!className) {
Q_ASSERT(app_pal);
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
emit qGuiApp->paletteChanged(*QGuiApplicationPrivate::app_pal);
QT_WARNING_POP
}
if (is_app_running && !is_app_closing) {
@ -3423,7 +3426,10 @@ void QGuiApplication::setFont(const QFont &font)
if (emitChange && qGuiApp) {
auto font = *QGuiApplicationPrivate::app_font;
locker.unlock();
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
emit qGuiApp->fontChanged(font);
QT_WARNING_POP
QEvent event(QEvent::ApplicationFontChange);
QGuiApplication::sendEvent(qGuiApp, &event);
}

View File

@ -190,8 +190,8 @@ Q_SIGNALS:
#endif
void applicationDisplayNameChanged();
#if QT_DEPRECATED_SINCE(6, 0)
void paletteChanged(const QPalette &pal);
void fontChanged(const QFont &font);
QT_DEPRECATED_VERSION_X_6_0("Handle QEvent::ApplicationPaletteChange instead") void paletteChanged(const QPalette &pal);
QT_DEPRECATED_VERSION_X_6_0("Handle QEvent::ApplicationFontChange instead") void fontChanged(const QFont &font);
#endif
protected:
bool event(QEvent *) override;