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>
This commit is contained in:
Ulf Hermann 2021-06-17 08:59:51 +02:00
parent f3c9200b5c
commit 1015919e8e
2 changed files with 8 additions and 0 deletions

View File

@ -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,

View File

@ -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 };