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 <Friedemann.Kleint@qt.io>
This commit is contained in:
Volker Hilsheimer 2024-12-17 10:34:08 +01:00
parent 1dc15c11db
commit ec011141b8
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);