QPainterStateGuard: make InitialState enum scoped

Address comment from header review,
amends 9ecf47a8a8d11227ecf192246d7df7c2c4dc9105.

Task-number: QTBUG-132090
Change-Id: Idddca104b93ee23f4bac8621f1087a0ae7a1fe24
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit ec011141b8d17a2edc58e0d5b6ebb0f1632fff90)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Volker Hilsheimer 2024-12-17 10:34:08 +01:00 committed by Qt Cherry-pick Bot
parent 0dd2561d54
commit 3339990b4b
2 changed files with 6 additions and 6 deletions

View File

@ -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.
*/
/*!

View File

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