reset hint fixed
This commit is contained in:
parent
4e438df051
commit
cb5f7df765
@ -142,14 +142,9 @@ void QskControl::setBackground( const QskGradient& gradient )
|
|||||||
void QskControl::resetBackground()
|
void QskControl::resetBackground()
|
||||||
{
|
{
|
||||||
using namespace QskAspect;
|
using namespace QskAspect;
|
||||||
const Aspect aspect = Control | Color;
|
|
||||||
|
|
||||||
auto& table = hintTable();
|
if ( resetHint( Control | Color ) )
|
||||||
|
|
||||||
if ( table.hint( aspect ).isValid() )
|
|
||||||
{
|
{
|
||||||
table.removeHint( aspect );
|
|
||||||
|
|
||||||
update();
|
update();
|
||||||
Q_EMIT backgroundChanged();
|
Q_EMIT backgroundChanged();
|
||||||
}
|
}
|
||||||
@ -195,15 +190,8 @@ void QskControl::setMargins( const QMarginsF& margins )
|
|||||||
void QskControl::resetMargins()
|
void QskControl::resetMargins()
|
||||||
{
|
{
|
||||||
using namespace QskAspect;
|
using namespace QskAspect;
|
||||||
const Aspect aspect = Control | Metric | Margin;
|
|
||||||
|
|
||||||
const auto oldMargin = marginsHint( aspect );
|
if ( resetHint( Control | Metric | Margin ) )
|
||||||
|
|
||||||
auto& table = hintTable();
|
|
||||||
if ( table.hint( aspect ).isValid() )
|
|
||||||
{
|
|
||||||
table.removeHint( aspect );
|
|
||||||
if ( marginsHint( aspect ) != oldMargin )
|
|
||||||
{
|
{
|
||||||
resetImplicitSize();
|
resetImplicitSize();
|
||||||
|
|
||||||
@ -214,7 +202,6 @@ void QskControl::resetMargins()
|
|||||||
qskSendEventTo( this, QEvent::ContentsRectChange );
|
qskSendEventTo( this, QEvent::ContentsRectChange );
|
||||||
Q_EMIT marginsChanged();
|
Q_EMIT marginsChanged();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QMarginsF QskControl::margins() const
|
QMarginsF QskControl::margins() const
|
||||||
|
@ -421,15 +421,29 @@ QskAnimationHint QskSkinnable::effectiveAnimation(
|
|||||||
|
|
||||||
bool QskSkinnable::resetHint( QskAspect::Aspect aspect )
|
bool QskSkinnable::resetHint( QskAspect::Aspect aspect )
|
||||||
{
|
{
|
||||||
const auto value = m_data->hintTable.takeHint( aspect );
|
if ( !m_data->hintTable.hasHint( aspect ) )
|
||||||
|
|
||||||
if ( value.isValid() )
|
|
||||||
{
|
|
||||||
// return true, if the value has changed
|
|
||||||
return value != storedHint( aspect );
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
/*
|
||||||
|
To be able to indicate, when the resolved value has changed
|
||||||
|
we retrieve the value before and after removing the hint from
|
||||||
|
the local table. An implementation with less lookups
|
||||||
|
should be possible, but as reset is a low frequently called
|
||||||
|
operation, we prefer to keep the implementation simple.
|
||||||
|
*/
|
||||||
|
|
||||||
|
auto a = aspect;
|
||||||
|
a.setSubControl( effectiveSubcontrol( a.subControl() ) );
|
||||||
|
a.setPlacement( effectivePlacement() );
|
||||||
|
|
||||||
|
if ( a.state() == QskAspect::NoState )
|
||||||
|
a = a | skinState();
|
||||||
|
|
||||||
|
const auto oldHint = storedHint( a );
|
||||||
|
|
||||||
|
m_data->hintTable.removeHint( aspect );
|
||||||
|
|
||||||
|
return oldHint != storedHint( a );
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant QskSkinnable::effectiveHint(
|
QVariant QskSkinnable::effectiveHint(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user