From bb4402af2b2233100f9ca4a853af34b46cc60ffd Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Mon, 8 Jun 2020 21:16:10 +0200 Subject: [PATCH] Add deprecation warnings to QGuiApplication::fontChanged/paletteChanged MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit And silence those warnings in code that emits those signals. Change-Id: Ic9013648060c9b84b59c44bb5a8c77e48f82d24f Reviewed-by: Tor Arne Vestbø --- src/gui/kernel/qguiapplication.cpp | 6 ++++++ src/gui/kernel/qguiapplication.h | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index a1e5da4a321..c6d6a97547c 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -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); } diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h index 6017cf513f2..ac90e18ef92 100644 --- a/src/gui/kernel/qguiapplication.h +++ b/src/gui/kernel/qguiapplication.h @@ -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;