QskSkinnable::resetHint changed

This commit is contained in:
Uwe Rathmann 2019-12-14 13:34:30 +01:00
parent 8fccc35156
commit 4e438df051
3 changed files with 17 additions and 20 deletions

View File

@ -4,7 +4,6 @@
*****************************************************************************/ *****************************************************************************/
#include "QskBox.h" #include "QskBox.h"
#include "QskSkinHintTable.h"
QSK_SUBCONTROL( QskBox, Panel ) QSK_SUBCONTROL( QskBox, Panel )
@ -72,25 +71,15 @@ void QskBox::setPadding( const QMarginsF& padding )
void QskBox::resetPadding() void QskBox::resetPadding()
{ {
using namespace QskAspect; using namespace QskAspect;
const Aspect aspect = QskBox::Panel | Metric | Padding;
const auto oldPadding = marginsHint( aspect ); if ( resetHint( QskBox::Panel | Metric | Padding ) )
auto& table = hintTable();
if ( table.hint( aspect ).isValid() )
{ {
table.removeHint( aspect ); resetImplicitSize();
const auto padding = marginsHint( aspect ); if ( polishOnResize() || autoLayoutChildren() )
if ( padding != oldPadding ) polish();
{
resetImplicitSize();
if ( polishOnResize() || autoLayoutChildren() ) Q_EMIT paddingChanged( padding() );
polish();
Q_EMIT paddingChanged( padding );
}
} }
} }

View File

@ -419,9 +419,17 @@ QskAnimationHint QskSkinnable::effectiveAnimation(
return hint; return hint;
} }
void QskSkinnable::resetHint( QskAspect::Aspect aspect ) bool QskSkinnable::resetHint( QskAspect::Aspect aspect )
{ {
m_data->hintTable.removeHint( aspect ); const auto value = m_data->hintTable.takeHint( aspect );
if ( value.isValid() )
{
// return true, if the value has changed
return value != storedHint( aspect );
}
return false;
} }
QVariant QskSkinnable::effectiveHint( QVariant QskSkinnable::effectiveHint(
@ -571,7 +579,7 @@ const QVariant& QskSkinnable::storedHint(
if ( aspect.subControl() != QskAspect::Control ) if ( aspect.subControl() != QskAspect::Control )
{ {
// trying to resolve something the skin default settings // trying to resolve something from the skin default settings
aspect.setSubControl( QskAspect::Control ); aspect.setSubControl( QskAspect::Control );
aspect.clearStates(); aspect.clearStates();

View File

@ -112,7 +112,7 @@ class QSK_EXPORT QskSkinnable
void setAnimation( QskAspect::Aspect, QskAnimationHint ); void setAnimation( QskAspect::Aspect, QskAnimationHint );
QskAnimationHint animation( QskAspect::Aspect, QskSkinHintStatus* = nullptr ) const; QskAnimationHint animation( QskAspect::Aspect, QskSkinHintStatus* = nullptr ) const;
void resetHint( QskAspect::Aspect ); bool resetHint( QskAspect::Aspect );
QskAnimationHint effectiveAnimation( QskAspect::Type, QskAspect::Subcontrol, QskAnimationHint effectiveAnimation( QskAspect::Type, QskAspect::Subcontrol,
QskAspect::State, QskSkinHintStatus* status = nullptr ) const; QskAspect::State, QskSkinHintStatus* status = nullptr ) const;