From 4c522e0226da1bcc67a585130e3b2a976be128fd Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sun, 16 Dec 2018 13:19:22 +0100 Subject: QPalette: mark foreground()/background() as deprecated MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QPalette::foreground()/background()/ColorRole::Foreground/Background are deprecated since Qt4 times. Therefore mark them as deprecated so they can be removed in Qt6. Change-Id: I24a47e080241b7f16b8adde1f9f16e29133462a7 Reviewed-by: Lars Knoll Reviewed-by: André Hartmann --- src/gui/kernel/qpalette.cpp | 2 +- src/gui/kernel/qpalette.h | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp index 9ccfb9b819..16b1f847bd 100644 --- a/src/gui/kernel/qpalette.cpp +++ b/src/gui/kernel/qpalette.cpp @@ -981,7 +981,7 @@ QPalette QPalette::resolve(const QPalette &other) const #ifndef QT_NO_DATASTREAM static const int NumOldRoles = 7; -static const int oldRoles[7] = { QPalette::Foreground, QPalette::Background, QPalette::Light, +static const int oldRoles[7] = { QPalette::WindowText, QPalette::Window, QPalette::Light, QPalette::Dark, QPalette::Mid, QPalette::Text, QPalette::Base }; /*! diff --git a/src/gui/kernel/qpalette.h b/src/gui/kernel/qpalette.h index 071eddbc4d..e931e01480 100644 --- a/src/gui/kernel/qpalette.h +++ b/src/gui/kernel/qpalette.h @@ -98,7 +98,10 @@ public: ToolTipBase, ToolTipText, PlaceholderText, NColorRoles = PlaceholderText + 1, - Foreground = WindowText, Background = Window +#if QT_DEPRECATED_SINCE(5, 13) + Foreground Q_DECL_ENUMERATOR_DEPRECATED_X("Use QPalette::WindowText instead") = WindowText, + Background Q_DECL_ENUMERATOR_DEPRECATED_X("Use QPalette::Window instead") = Window +#endif }; Q_ENUM(ColorRole) @@ -121,7 +124,6 @@ public: inline const QColor &color(ColorRole cr) const { return color(Current, cr); } inline const QBrush &brush(ColorRole cr) const { return brush(Current, cr); } - inline const QBrush &foreground() const { return brush(WindowText); } inline const QBrush &windowText() const { return brush(WindowText); } inline const QBrush &button() const { return brush(Button); } inline const QBrush &light() const { return brush(Light); } @@ -132,7 +134,6 @@ public: inline const QBrush &alternateBase() const { return brush(AlternateBase); } inline const QBrush &toolTipBase() const { return brush(ToolTipBase); } inline const QBrush &toolTipText() const { return brush(ToolTipText); } - inline const QBrush &background() const { return brush(Window); } inline const QBrush &window() const { return brush(Window); } inline const QBrush &midlight() const { return brush(Midlight); } inline const QBrush &brightText() const { return brush(BrightText); } @@ -143,6 +144,12 @@ public: inline const QBrush &link() const { return brush(Link); } inline const QBrush &linkVisited() const { return brush(LinkVisited); } inline const QBrush &placeholderText() const { return brush(PlaceholderText); } +#if QT_DEPRECATED_SINCE(5, 13) + QT_DEPRECATED_X("Use QPalette::windowText() instead") + inline const QBrush &foreground() const { return windowText(); } + QT_DEPRECATED_X("Use QPalette::window() instead") + inline const QBrush &background() const { return window(); } +#endif bool operator==(const QPalette &p) const; inline bool operator!=(const QPalette &p) const { return !(operator==(p)); } -- cgit v1.2.3