diff options
author | Albert Astals Cid <albert.astals@canonical.com> | 2013-04-25 10:59:35 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-04-26 09:59:04 +0200 |
commit | 9b021a1fbd0b974a452a6e18a8c0b4b97cbf8edb (patch) | |
tree | 8cbb52f561e6d3a64bc46a3be3d0fbe259d1600c /src/gui/painting/qcolor.h | |
parent | 08585f02dc0eb8dc5567f47c55915540c0a34e01 (diff) |
Make QColor understand #AARRGGBB
This way I can have in my QtQuick something like
Text {
text: "<font color='#ff0000'>H</font> <font color='#99ff0000'>H</font>"
}
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 <gunnar.sletta@digia.com>
Diffstat (limited to 'src/gui/painting/qcolor.h')
-rw-r--r-- | src/gui/painting/qcolor.h | 3 |
1 files changed, 3 insertions, 0 deletions
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(); |