From ec011141b8d17a2edc58e0d5b6ebb0f1632fff90 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Tue, 17 Dec 2024 10:34:08 +0100 Subject: [PATCH] QPainterStateGuard: make InitialState enum scoped Address comment from header review, amends 9ecf47a8a8d11227ecf192246d7df7c2c4dc9105. Task-number: QTBUG-132090 Pick-to: 6.9 Change-Id: Idddca104b93ee23f4bac8621f1087a0ae7a1fe24 Reviewed-by: Friedemann Kleint --- src/gui/painting/qpainterstateguard.cpp | 7 ++++--- src/gui/painting/qpainterstateguard.h | 5 ++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui/painting/qpainterstateguard.cpp b/src/gui/painting/qpainterstateguard.cpp index 96aa182dab8..b62400fa3b6 100644 --- a/src/gui/painting/qpainterstateguard.cpp +++ b/src/gui/painting/qpainterstateguard.cpp @@ -30,10 +30,11 @@ QT_BEGIN_NAMESPACE */ /*! - \fn QPainterStateGuard::QPainterStateGuard(QPainter *painter, InitialState state = Save) + \fn QPainterStateGuard::QPainterStateGuard(QPainter *painter, InitialState state = InitialState::Save) Constructs a QPainterStateGuard and calls save() on \a painter if \a state - is \c Save (which is the default). When QPainterStateGuard is destroyed, restore() - is called as often as save() was called to restore the QPainter's state. + is \c InitialState::Save (which is the default). When QPainterStateGuard is + destroyed, restore() is called as often as save() was called to restore the + QPainter's state. */ /*! diff --git a/src/gui/painting/qpainterstateguard.h b/src/gui/painting/qpainterstateguard.h index dcb7b48f9b0..01e1a0a1163 100644 --- a/src/gui/painting/qpainterstateguard.h +++ b/src/gui/painting/qpainterstateguard.h @@ -13,14 +13,13 @@ class QPainterStateGuard { Q_DISABLE_COPY_MOVE(QPainterStateGuard) public: - enum InitialState - { + enum class InitialState : quint8 { Save, NoSave, }; Q_NODISCARD_CTOR - explicit QPainterStateGuard(QPainter *painter, InitialState state = Save) + explicit QPainterStateGuard(QPainter *painter, InitialState state = InitialState::Save) : m_painter(painter) { Q_ASSERT(painter);