From 908bfa7782b6b7d9a32092c5b8960b4476c467a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 17 Dec 2020 20:48:31 +0100 Subject: [PATCH] Update QPalette() documentation to not mention the application palette It's an implementation detail that the default constructed palette happens to use the d-pointer of the application palette, and as a result has the same colors as the application palette if requested. The palette has an empty resolve mask, and hence all the colors in the palette are undefined. Users should not rely on QPalette() to represent the application palette when for example overriding a parent palette. Task-number: QTBUG-85226 Change-Id: Ia6747887eef6e9a5f21b2002066608c433260de2 Reviewed-by: Friedemann Kleint Reviewed-by: Paul Wicking Reviewed-by: Volker Hilsheimer (cherry picked from commit 74559dccc84ed0f0f7d8f57165fe387c3e112485) Reviewed-by: Qt Cherry-pick Bot --- src/gui/kernel/qpalette.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp index 963526c1537..2cdc9fddc60 100644 --- a/src/gui/kernel/qpalette.cpp +++ b/src/gui/kernel/qpalette.cpp @@ -530,7 +530,10 @@ static void qt_palette_from_color(QPalette &pal, const QColor &button) */ /*! - Constructs a palette object that uses the application's default palette. + Constructs an empty palette object with no color roles set. + + When used as the palette of a QWidget the colors are resolved + as described by QWidget::setPalette(). \sa QApplication::setPalette(), QApplication::palette() */