summaryrefslogtreecommitdiffstats
path: root/src/corelib/serialization
diff options
context:
space:
mode:
authorAxel Spoerl <axel.spoerl@qt.io>2023-05-15 17:32:28 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2023-05-21 18:36:37 +0200
commit17c589df94a2245ee92d45839c2cba73566d7310 (patch)
tree9c9c5e9366be2ed065f3e2b3cff09b40cb27fc66 /src/corelib/serialization
parent0328e4297e339de8a2acd84979c667936f6fadf8 (diff)
Shoehorn AccentColor into QPalette and keep existing 64bit resolve mask
It is necessary to add an AccentColor role to QPalette. QPalette currently has 21 color roles and 3 color groups, which require 63 bits to resolve. The resolve mask is implemented with a qint64, which doesn't provide spare bits for another color role. The color role NoRole is used as a default value, marking that a role has not (yet) been defined. The enum value does not represent a valid brush, even though it can theoretically be stored in QPalette's shared data. This patch adds the enum value AccentColor to QPalette::ColorRole, increasing the available color roles to 22. To keep the resolve mask at 63 bits, AccentColor is mapped to NoRole in static constexpr bitPosition. As the enum range would exceed 64 bits without this tweak, 3 additional bits are substracted in the respective static assertion. With NoRole having no bit in the resolve mask, the following adaptions have been implemented: - QPalette::resolve() is adapted to explicitly ignore NoRole. - QPalette::isBrushSet() always returns false for NoRole. - tst_QPalette::setAllPossibleBrushes() to verify the latter - operator== ignores NoRole (documentation updated) AccentColor is added in tst_QPalette::roleValues and enum documentation is adapted. In QPalette's default constructor, the AccentColor brush is defaulting to the Highlight brush, it this is available. Otherwise it is made 30% darker or lighter than the Base brush, depending on dark/light mode heuristics. QPalette's data stram functions have been extended from QDataStream Version Qt_6_6. If earlier versions are de-serialised, the AccentColor defaults to Highlight. An autotest function dataStream() has been added to tst_QPalette. The QDataStream Version Qt_6_6 has been bumped to 21. tst_QDataStream has been adapted to the new version and the new color Role. Change-Id: I98bbf9de95fb83bda921e9614a0db3a3c0ebdf75 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/corelib/serialization')
-rw-r--r--src/corelib/serialization/qdatastream.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/serialization/qdatastream.h b/src/corelib/serialization/qdatastream.h
index 0942c3ed1d..9e35328de4 100644
--- a/src/corelib/serialization/qdatastream.h
+++ b/src/corelib/serialization/qdatastream.h
@@ -68,7 +68,7 @@ public:
Qt_6_3 = Qt_6_0,
Qt_6_4 = Qt_6_0,
Qt_6_5 = Qt_6_0,
- Qt_6_6 = Qt_6_0,
+ Qt_6_6 = 21,
Qt_DefaultCompiledVersion = Qt_6_6
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
#error Add the datastream version for this Qt version and update Qt_DefaultCompiledVersion