diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-06-17 08:59:51 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-06-30 10:39:06 +0200 |
commit | 1015919e8e828f886fbd15e7929fb634363ddc35 (patch) | |
tree | 8c3228738897427b4afb6ddd4baa2cf57722f2fd /src/gui | |
parent | f3c9200b5c9fe5ac6d65f8480355520fa8d39bc4 (diff) |
Add Qt7 TODOs for reducing the size of QColor
It could fit into QVariant's inline storage if we didn't waste so much
space.
Change-Id: Ie9e592a49c955b0a97a202e0bd875183396af993
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/painting/qcolor.cpp | 6 | ||||
-rw-r--r-- | src/gui/painting/qcolor.h | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp index 8e5f6e31c7..d4725829aa 100644 --- a/src/gui/painting/qcolor.cpp +++ b/src/gui/painting/qcolor.cpp @@ -54,6 +54,12 @@ QT_BEGIN_NAMESPACE +// QColor fits into QVariant's internal storage on 64bit systems. +// It could also fit on 32bit systems, but we cannot make it happen in Qt6, due to BC. +#if QT_VERSION >= QT_VERSION_CHECK(7,0,0) || QT_POINTER_SIZE > 4 +static_assert(sizeof(QColor) <= QVariant::Private::MaxInternalSize); +#endif + /*! \internal If s[0..n] is a valid hex number, returns its integer value, diff --git a/src/gui/painting/qcolor.h b/src/gui/painting/qcolor.h index 06b264eacf..edeba6fe61 100644 --- a/src/gui/painting/qcolor.h +++ b/src/gui/painting/qcolor.h @@ -66,6 +66,8 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QColor &); class Q_GUI_EXPORT QColor { public: + // ### Qt7: make this "enum Spec: quint8 {...}" and reorder the members below for tighter + // struct packing. QColor could fit into the inline storage of a QVariant on 32bit. enum Spec { Invalid, Rgb, Hsv, Cmyk, Hsl, ExtendedRgb }; enum NameFormat { HexRgb, HexArgb }; |