diff options
author | Andy Shaw <andy.shaw@qt.io> | 2020-05-07 15:46:11 +0200 |
---|---|---|
committer | Andy Shaw <andy.shaw@qt.io> | 2020-05-15 18:46:39 +0200 |
commit | 9803ba9b6f74f5ac18220fe145fe1fe4c8f70910 (patch) | |
tree | 5e8ebce91c8d308bade5360f8affee7fa3092de8 /src/gui/kernel/qguiapplication.cpp | |
parent | bd3b978701c32b2e13da853f2064aab369e32745 (diff) |
Deprecate QGuiApplication::paletteChanged() signal
Rather than have a paletteChanged() signal which can be connected to for
tracking when the application palette has changed, then it is better to
use the event that is sent to all windows and the application itself.
That way it is easy for a window/widget or item that cares about the
change to the application font to catch it in the event() function.
[ChangeLog][QtGui][QGuiApplication] Deprecated paletteChanged() signal
in favor of QEvent::ApplicationPaletteChanged.
Change-Id: I95da211e30590e357007cc14d8ee266baceba7b3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/gui/kernel/qguiapplication.cpp')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 45df47730d..c6facb8ceb 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1900,10 +1900,11 @@ bool QGuiApplication::event(QEvent *e) if (topLevelWindow->flags() != Qt::Desktop) postEvent(topLevelWindow, new QEvent(QEvent::LanguageChange)); } - } else if (e->type() == QEvent::ApplicationFontChange) { + } else if (e->type() == QEvent::ApplicationFontChange || + e->type() == QEvent::ApplicationPaletteChange) { for (auto *topLevelWindow : QGuiApplication::topLevelWindows()) { if (topLevelWindow->flags() != Qt::Desktop) - postEvent(topLevelWindow, new QEvent(QEvent::ApplicationFontChange)); + postEvent(topLevelWindow, new QEvent(e->type())); } } else if (e->type() == QEvent::Quit) { // Close open windows. This is done in order to deliver de-expose @@ -3271,8 +3272,10 @@ QClipboard * QGuiApplication::clipboard() /*! \since 5.4 \fn void QGuiApplication::paletteChanged(const QPalette &palette) + \obsolete - This signal is emitted when the \a palette of the application changes. + This signal is emitted when the \a palette of the application changes. Use + QEvent::ApplicationPaletteChanged instead. \sa palette() */ |