takeHint added, removeHint with return code
This commit is contained in:
parent
896772c9b4
commit
0b8d857714
@ -115,12 +115,14 @@ void QskSkinHintTable::setHint( QskAspect::Aspect aspect, const QVariant& skinHi
|
||||
m_hasStates = true;
|
||||
}
|
||||
|
||||
void QskSkinHintTable::removeHint( QskAspect::Aspect aspect )
|
||||
bool QskSkinHintTable::removeHint( QskAspect::Aspect aspect )
|
||||
{
|
||||
if ( m_hints == nullptr )
|
||||
return;
|
||||
return false;
|
||||
|
||||
if ( m_hints->erase( aspect ) )
|
||||
const bool erased = m_hints->erase( aspect );
|
||||
|
||||
if ( erased )
|
||||
{
|
||||
if ( aspect.isAnimator() )
|
||||
m_animatorCount--;
|
||||
@ -131,6 +133,34 @@ void QskSkinHintTable::removeHint( QskAspect::Aspect aspect )
|
||||
m_hints = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
return erased;
|
||||
}
|
||||
|
||||
QVariant QskSkinHintTable::takeHint( QskAspect::Aspect aspect )
|
||||
{
|
||||
if ( m_hints )
|
||||
{
|
||||
auto it = m_hints->find( aspect );
|
||||
if ( it != m_hints->end() )
|
||||
{
|
||||
const auto value = it->second;
|
||||
m_hints->erase( it );
|
||||
|
||||
if ( aspect.isAnimator() )
|
||||
m_animatorCount--;
|
||||
|
||||
if ( m_hints->empty() )
|
||||
{
|
||||
delete m_hints;
|
||||
m_hints = nullptr;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
void QskSkinHintTable::clear()
|
||||
|
@ -33,7 +33,7 @@ class QSK_EXPORT QskSkinHintTable
|
||||
void setColor( QskAspect::Aspect, QRgb );
|
||||
|
||||
void setColor( QskAspect::Aspect, const QColor& );
|
||||
QColor color( QskAspect::Aspect aspect ) const;
|
||||
QColor color( QskAspect::Aspect ) const;
|
||||
|
||||
void setMetric( QskAspect::Aspect, qreal metric );
|
||||
qreal metric( QskAspect::Aspect ) const;
|
||||
@ -62,7 +62,9 @@ class QSK_EXPORT QskSkinHintTable
|
||||
|
||||
void setHint( QskAspect::Aspect, const QVariant& );
|
||||
const QVariant& hint( QskAspect::Aspect ) const;
|
||||
void removeHint( QskAspect::Aspect );
|
||||
|
||||
bool removeHint( QskAspect::Aspect );
|
||||
QVariant takeHint( QskAspect::Aspect );
|
||||
|
||||
bool hasHint( QskAspect::Aspect ) const;
|
||||
|
||||
@ -160,7 +162,8 @@ inline qreal QskSkinHintTable::metric( QskAspect::Aspect aspect ) const
|
||||
return hint( aspect | QskAspect::Metric ).toReal();
|
||||
}
|
||||
|
||||
inline void QskSkinHintTable::setMargins( QskAspect::Aspect aspect, const QskMargins& margins )
|
||||
inline void QskSkinHintTable::setMargins(
|
||||
QskAspect::Aspect aspect, const QskMargins& margins )
|
||||
{
|
||||
setHint( aspect | QskAspect::Metric, QVariant::fromValue( margins ) );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user