From 9b021a1fbd0b974a452a6e18a8c0b4b97cbf8edb Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Thu, 25 Apr 2013 10:59:35 +0200 Subject: Make QColor understand #AARRGGBB This way I can have in my QtQuick something like Text { text: "H H" } and it works properly QtQuick already supports #AARRGGBB for color: properties so I've decided to go the notation Once this is merged we can remove the extra code in QQuickColorProvider::QColorFromString I've also added some tests for the hex -> QColor conversion that where non existent Change-Id: I1dd4a2ec113293aec26968329b2e4930df6fdcb7 Reviewed-by: Gunnar Sletta --- src/gui/painting/qcolor.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/gui/painting/qcolor.h') diff --git a/src/gui/painting/qcolor.h b/src/gui/painting/qcolor.h index ef3503e8d8..1ede5a3682 100644 --- a/src/gui/painting/qcolor.h +++ b/src/gui/painting/qcolor.h @@ -65,6 +65,7 @@ class Q_GUI_EXPORT QColor { public: enum Spec { Invalid, Rgb, Hsv, Cmyk, Hsl }; + enum NameFormat { HexRgb, HexArgb }; QColor(); QColor(Qt::GlobalColor color); @@ -77,7 +78,9 @@ public: bool isValid() const; + // ### Qt 6: merge overloads QString name() const; + QString name(NameFormat format) const; void setNamedColor(const QString& name); static QStringList colorNames(); -- cgit v1.2.3