From 726aca98df4e6221ef5f1812b691c7fa7d5e3c3f Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Wed, 23 Dec 2020 09:28:17 +0100 Subject: [PATCH] QskAspect::hasState added --- src/common/QskAspect.h | 6 ++++++ src/controls/QskSkinnable.cpp | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/common/QskAspect.h b/src/common/QskAspect.h index cf0dced4..c90fd64d 100644 --- a/src/common/QskAspect.h +++ b/src/common/QskAspect.h @@ -154,6 +154,7 @@ class QSK_EXPORT QskAspect void setState( State ) noexcept; void addState( State ) noexcept; + constexpr bool hasState() const noexcept; void clearState( State ) noexcept; void clearStates() noexcept; @@ -359,6 +360,11 @@ inline void QskAspect::addState( State state ) noexcept m_bits.states |= state; } +inline constexpr bool QskAspect::hasState() const noexcept +{ + return m_bits.states; +} + inline void QskAspect::clearState( State state ) noexcept { m_bits.states &= ~state; diff --git a/src/controls/QskSkinnable.cpp b/src/controls/QskSkinnable.cpp index f873881c..0e00f085 100644 --- a/src/controls/QskSkinnable.cpp +++ b/src/controls/QskSkinnable.cpp @@ -609,7 +609,7 @@ bool QskSkinnable::resetSkinHint( QskAspect aspect ) auto a = aspect; a.setPlacement( effectivePlacement() ); - if ( a.state() == QskAspect::NoState ) + if ( !a.hasState() ) a.setState( skinState() ); const auto oldHint = storedHint( a ); @@ -632,7 +632,7 @@ QVariant QskSkinnable::effectiveSkinHint( if ( v.isValid() ) return v; - if ( aspect.state() == QskAspect::NoState ) + if ( !aspect.hasState() ) aspect.setState( skinState() ); return storedHint( aspect, status ); @@ -652,7 +652,7 @@ QVariant QskSkinnable::animatedValue( { QVariant v; - if ( aspect.state() == QskAspect::NoState ) + if ( !aspect.hasState() ) { /* The local animators were invented to be stateless